[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABPRKS8eGh8AkcxhLswOkaGHB2OewnbCcQd8=WoNiYuxeMGw8A@mail.gmail.com>
Date: Thu, 20 Jun 2024 09:43:34 -0700
From: Justin Tee <justintee8345@...il.com>
To: Huai-Yuan Liu <qq810974084@...il.com>
Cc: Justin Tee <justin.tee@...adcom.com>, james.smart@...adcom.com,
dick.kennedy@...adcom.com, James.Bottomley@...senpartnership.com,
martin.petersen@...cle.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org, baijiaju1990@...il.com
Subject: Re: [PATCH V3] scsi: lpfc: Fix a possible null pointer dereference
Hi Huai-Yuan,
Sorry for noticing this later, but a return len while len is 0 would
result in a silent $(cat /sys/class/scsi_host/host*/lpfc_xcvr_data).
Perhaps, it's better to log something to at least notify the user why
SFP information was not able to be collected.
How about something like this?
/* Get transceiver information */
rdp_context = kmalloc(sizeof(*rdp_context), GFP_KERNEL);
+ if (!rdp_context) {
+ len = scnprintf(buf, PAGE_SIZE - len,
+ "SFP info NA: alloc failure\n");
+ return len;
+ }
rc = lpfc_get_sfp_info_wait(phba, rdp_context);
if (rc) {
Thanks,
Justin Tee
Powered by blists - more mailing lists