* Re: [PATCH] scsi: virtio_scsi: Modify the kmalloc allocation flag
2023-02-18 0:53 [PATCH] scsi: virtio_scsi: Modify the kmalloc allocation flag Li zeming
@ 2023-02-16 16:51 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2023-02-16 16:51 UTC (permalink / raw)
To: Li zeming
Cc: mst, jasowang, pbonzini, stefanha, jejb, martin.petersen,
virtualization, linux-scsi, linux-kernel
On Sat, Feb 18, 2023 at 08:53:56AM +0800, Li zeming wrote:
> The inq_result pointer must be allocated successfully; otherwise,
> subsequent function execution may crash.
The error needs to be handled. Or in fact this LLDD needs to stop
breaking layering and issuing it's own INQUIRY commands.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] scsi: virtio_scsi: Modify the kmalloc allocation flag
@ 2023-02-18 0:53 Li zeming
2023-02-16 16:51 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Li zeming @ 2023-02-18 0:53 UTC (permalink / raw)
To: mst, jasowang, pbonzini, stefanha, jejb, martin.petersen
Cc: virtualization, linux-scsi, linux-kernel, Li zeming
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-16 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-18 0:53 [PATCH] scsi: virtio_scsi: Modify the kmalloc allocation flag Li zeming
2023-02-16 16:51 ` Christoph Hellwig
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®