RE: [PATCH 1/2] scsi: fnic: initialize the NVMe local port info before registering
"Karan Tilak Kumar (kartilak)" <[email protected]>
| Newsgroups | gmane.linux.scsi,gmane.linux.kernel |
|---|---|
| Message-ID | <SJ0PR11MB58963CA2B53ABA6D1E89A0B1C3A12@SJ0PR11MB5896.namprd11.prod.outlook.com> |
On Sunday, August 23, 2026 10:35 AM, Karan Tilak Kumar (kartilak) wrote: > > On Wednesday, August 19, 2026 5:13 PM, Linmao Li <[email protected]> wrote: > > > > nvfnic_add_lport() declares struct nvme_fc_port_info on the stack and > > fills in four of its five members, leaving dev_loss_tmo holding whatever > > the stack happened to contain before the call. The structure is then > > handed to nvme_fc_register_localport(). > > > > nvfnic_add_tport(), which registers the remote port a few lines further > > down, memsets its own struct nvme_fc_port_info first, so only the local > > port path passes uninitialized data across the transport interface. > > > > The NVMe/FC transport documents dev_loss_tmo as "Used only on a > > remoteport" and does not read it in nvme_fc_register_localport(), so > > there is no behavioural change today. Initialize the structure anyway: > > the driver must not depend on which members the transport happens to > > consume, and any member added to struct nvme_fc_port_info later would > > silently start out as stack garbage. > > > > Signed-off-by: Linmao Li <[email protected]> > > --- > > drivers/scsi/fnic/fnic_nvme.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/scsi/fnic/fnic_nvme.c b/drivers/scsi/fnic/fnic_nvme.c > > index b237948dcafdc..00d9d5d439a38 100644 > > --- a/drivers/scsi/fnic/fnic_nvme.c > > +++ b/drivers/scsi/fnic/fnic_nvme.c > > @@ -2216,7 +2216,7 @@ int nvfnic_add_tport(struct fnic *fnic, struct fnic_tport_s *tport, > > > > int nvfnic_add_lport(struct fnic *fnic) > > { > > - struct nvme_fc_port_info pinfo; > > + struct nvme_fc_port_info pinfo = {}; > > struct fnic_iport_s *iport = &fnic->iport; > > int ret = 0; > > > > -- > > 2.25.1 > > > > > > Thanks for the change, Linmao. > It seems simple and straightforward. > I'll bundle it up with the other change in our internal testing and get back to you. > > Regards, > Karan > Just realized that you've requested to drop patch 2/2. I'll do a build and load of this change and check that nothing's broken. I'll get back to you. Regards, Karan