From: Li zeming <zeming@nfschina.com>
To: mst@redhat.com, jasowang@redhat.com, pbonzini@redhat.com,
stefanha@redhat.com, jejb@linux.ibm.com,
martin.petersen@oracle.com
Cc: virtualization@lists.linux-foundation.org,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
Li zeming <zeming@nfschina.com>
Subject: [PATCH] scsi: virtio_scsi: Modify the kmalloc allocation flag
Date: Sat, 18 Feb 2023 08:53:56 +0800 [thread overview]
Message-ID: <20230218005356.3932-1-zeming@nfschina.com> (raw)
The inq_result pointer must be allocated successfully; otherwise,
subsequent function execution may crash.
Signed-off-by: Li zeming <zeming@nfschina.com>
---
drivers/scsi/virtio_scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index d07d24c06b54..3252f4b42261 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -336,7 +336,7 @@ static void virtscsi_rescan_hotunplug(struct virtio_scsi *vscsi)
struct Scsi_Host *shost = virtio_scsi_host(vscsi->vdev);
unsigned char scsi_cmd[MAX_COMMAND_SIZE];
int result, inquiry_len, inq_result_len = 256;
- char *inq_result = kmalloc(inq_result_len, GFP_KERNEL);
+ char *inq_result = kmalloc(inq_result_len, __GFP_NOFAIL);
shost_for_each_device(sdev, shost) {
inquiry_len = sdev->inquiry_len ? sdev->inquiry_len : 36;
--
2.18.2
next reply other threads:[~2023-02-16 8:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-18 0:53 Li zeming [this message]
2023-02-16 16:51 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230218005356.3932-1-zeming@nfschina.com \
--to=zeming@nfschina.com \
--cc=jasowang@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=stefanha@redhat.com \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®