scsi: FDMI Fixes
Subsystems (2)
cover scsi: FDMI Fixes
This series has two fixes for FDMI.
Attributes length corrected for RHBA.
Fixed the wrong condition check in fc_ct_ms_fill_attr().
Kindly apply this series to scsi-queue at your earliest convenience.
Javed Hasan (2):
scsi: fc: Corrected RHBA attributes length
libfc: Corrected the condition check and invalid argument passed
drivers/scsi/libfc/fc_encode.h | 8 +++++--- include/scsi/fc/fc_ms.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 scsi: fc: Corrected RHBA attributes length
-As per document of FC-GS-5, attribute lengths of node_name
and manufacturer should in range of "4 to 64 Bytes" only.
--- include/scsi/fc/fc_ms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/scsi/fc/fc_ms.h +2 -2
@@ -63,8 +63,8 @@ enum fc_fdmi_hba_attr_type {* HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80 -#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80 +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64#define FC_FDMI_HBA_ATTR_MODEL_LEN 256#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256
Signature · 1 line
2.26.2
Re: [PATCH 1/2] scsi: fc: Corrected RHBA attributes length
Quoted 15 lines · Javed Hasan
-As per document of FC-GS-5, attribute lengths of
node_name
and manufacturer should in range of "4 to 64 Bytes" only.Signed-off-by Javed Hasan <[email protected]>--- include/scsi/fc/fc_ms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/scsi/fc/fc_ms.h +0
-0
include/scsi/fc/fc_ms.h enum fc_fdmi_hba_attr_type { · line 70
Quoted 10 lines
include/scsi/fc/fc_ms.h +2
-2@@ -63,8 +63,8 @@ enum fc_fdmi_hba_attr_type {* HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80 -#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80 +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64#define FC_FDMI_HBA_ATTR_MODEL_LEN 256#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256
Looks good.
Signature · 1 line
Himanshu Madhani Oracle Linux Engineering
Re: [PATCH 1/2] scsi: fc: Corrected RHBA attributes length
Quoted 31 lines · Himanshu Madhani
Quoted 15 lines · Javed Hasan
-As per document of FC-GS-5, attribute lengths of
node_nameand manufacturer should in range of "4 to 64 Bytes" only.Signed-off-by Javed Hasan <[email protected]>---
include/scsi/fc/fc_ms.h| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)include/scsi/fc/fc_ms.h +0
-0include/scsi/fc/fc_ms.h enum fc_fdmi_hba_attr_type { · line 70
Quoted 10 lines
include/scsi/fc/fc_ms.h +2
-2@@ -63,8 +63,8 @@ enum fc_fdmi_hba_attr_type {* HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80 -#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80 +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64 #define FC_FDMI_HBA_ATTR_MODEL_LEN 256 #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256Looks good.
Quoted 2 lines
Reviewed-by Himanshu Madhani <[email protected]>
I just noticed that this patch is basically reverting commit e721eb0616f62e766882b80fd3433b80635abd5f ("scsi: scsi_transport_fc: Match HBA Attribute Length with HBAAPI V2.0 definitions").
Have you verified that the compiler warnings do not resurface with your patch? if you see that compiler warning, please fix appropriately and resubmit this patch.
Signature · 1 line
Himanshu Madhani Oracle Linux Engineering
RE: [EXT] Re: [PATCH 1/2] scsi: fc: Corrected RHBA attributes length
Hello Himanshu,
There are no warnings resurfaced after this fix because second patch of this series taking care of those compiler warnings. Verified using "make W=1" Command.
Regards
Javed
-----Original Message-----
From: Himanshu Madhani <[email protected]>
Sent: Tuesday, June 1, 2021 11:38 PM
To: Javed Hasan <[email protected]>; [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <[email protected]>
Subject: [EXT] Re: [PATCH 1/2] scsi: fc: Corrected RHBA attributes length
External Email
----------------------------------------------------------------------
Quoted 31 lines · Himanshu Madhani
Quoted 21 lines · Javed Hasan
-As per document of FC-GS-5, attribute lengths of
node_nameand manufacturer should in range of "4 to 64 Bytes" only.Signed-off-by Javed Hasan <[email protected]>---
include/scsi/fc/fc_ms.h| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)include/scsi/fc/fc_ms.h index renamed from include/scsi/fc/fc_ms.h +0
-0
9e273fed0a85..800d53dc9470100644include/scsi/fc/fc_ms.h +0
-0@@ -63,8 +63,8 @@ enum fc_fdmi_hba_attr_type {* HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#defineFC_FDMI_HBA_ATTR_MANUFACTURER_LEN 80 -#define
FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 80include/scsi/fc/fc_ms.h +2
-0+#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 #define +FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64Quoted 4 lines
#define FC_FDMI_HBA_ATTR_MODEL_LEN 256 #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256 #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256
Looks good.
Quoted 2 lines
Reviewed-by Himanshu Madhani <[email protected]>
I just noticed that this patch is basically reverting commit e721eb0616f62e766882b80fd3433b80635abd5f ("scsi: scsi_transport_fc:
Match HBA Attribute Length with HBAAPI V2.0 definitions").
Have you verified that the compiler warnings do not resurface with your patch? if you see that compiler warning, please fix appropriately and resubmit this patch.
Signature · 1 line
Himanshu Madhani Oracle Linux Engineering
Re: [EXT] [PATCH 1/2] scsi: fc: Corrected RHBA attributes length
Quoted 9 lines · Javed Hasan
Hello Himanshu,
There are no warnings resurfaced after this fix because second patch of this series taking care of those compiler warnings. Verified using "make W=1" Command.
In that case, Please resubmit with Fixes tag and Cc to stable. You can keep my R-b.
Thanks.
Quoted 47 lines
Regards
Javed-----Original Message-----
From: Himanshu Madhani <[email protected]>
Sent: Tuesday, June 1, 2021 11:38 PM
To: Javed Hasan <[email protected]>; [email protected]
Cc: [email protected]; GR-QLogic-Storage-Upstream <[email protected]>
Subject: [EXT] Re: [PATCH 1/2] scsi: fc: Corrected RHBA attributes lengthExternal Email
----------------------------------------------------------------------
Quoted 31 lines · Himanshu Madhani
Quoted 20 lines · Javed Hasan
-As per document of FC-GS-5, attribute lengths of
node_name
and manufacturer should in range of "4 to 64 Bytes" only.Signed-off-by Javed Hasan <[email protected]>--- include/scsi/fc/fc_ms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/scsi/fc/fc_ms.h index renamed from include/scsi/fc/fc_ms.h +0
-0
9e273fed0a85..800d53dc9470100644include/scsi/fc/fc_ms.h +0
-0@@ -63,8 +63,8 @@ enum fc_fdmi_hba_attr_type {* HBA Attribute Length */ #define FC_FDMI_HBA_ATTR_NODENAME_LEN 8 -#define
FC_FDMI_HBA_ATTR_MANUFACTURER_LEN80 -#defineFC_FDMI_HBA_ATTR_SERIALNUMBER_LEN80include/scsi/fc/fc_ms.h enum fc_fdmi_hba_attr_type { · line 70
Quoted 5 lines
include/scsi/fc/fc_ms.h +2
-0+#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN 64 #define +FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN 64#define FC_FDMI_HBA_ATTR_MODEL_LEN 256#define FC_FDMI_HBA_ATTR_MODELDESCR_LEN 256#define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN 256Looks good.
Quoted 10 lines
Quoted 2 lines
Reviewed-by Himanshu Madhani <[email protected]>I just noticed that this patch is basically reverting commit
e721eb0616f62e766882b80fd3433b80635abd5f("scsi:scsi_transport_fc:
Match HBA Attribute Length with HBAAPI V2.0 definitions").Have you verified that the compiler warnings do not resurface with your patch? if you see that compiler warning, please fix appropriately and resubmit this patch.
Signature · 1 line
Himanshu Madhani Oracle Linux Engineering
--
Himanshu Madhani Oracle Linux Engineering
PATCH 2/2 libfc: Corrected the condition check and invalid argument passed
In reply to Javed Hasan -In correct condition check was leading to data corruption
and so the invalid argument.
--- drivers/scsi/libfc/fc_encode.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/libfc/fc_encode.h +5 -3
@@ -166,9 +166,11 @@ static inline int fc_ct_ns_fill(struct fc_lport *lport,static inline void fc_ct_ms_fill_attr (struct fc_fdmi_attr_entry *entry,const char *in,size_t len) { -int copied =strscpy (entry->value, in, len); -if (copied >0 ) -memset (entry->value, copied, len - copied); +int copied; + + copied =strscpy ((char *)&entry->value, in, len); +if (copied >0 && (copied +1 ) < len) +memset ((entry->value + copied +1 ),0 , len - copied -1 ); }/**
Signature · 1 line
2.26.2
Re: [PATCH 2/2] libfc: Corrected the condition check and invalid argument passed
Quoted 19 lines · Javed Hasan
-In correct condition check was leading to data corruption
and so the invalid argument.Signed-off-by Javed Hasan <[email protected]>--- drivers/scsi/libfc/fc_encode.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/scsi/libfc/fc_encode.h +0
-1@@ -166,9 +166,11 @@ static inline int fc_ct_ns_fill(struct fc_lport *lport,static inline void fc_ct_ms_fill_attr (struct fc_fdmi_attr_entry *entry,const char *in,size_t len) { -int copied =strscpy (entry->value, in, len);
drivers/scsi/libfc/fc_encode.h static inline int fc_ct_ns_fill(struct fc_lport *lport, · line 176
Quoted 10 lines
drivers/scsi/libfc/fc_encode.h +5
-2-if (copied >0 ) -memset (entry->value, copied, len - copied); +int copied; + + copied =strscpy ((char *)&entry->value, in, len); +if (copied >0 && (copied +1 ) < len) +memset ((entry->value + copied +1 ),0 , len - copied -1 ); }/**
This should have Oracle Linux Engineering
otherwise looks good.
Signature · 1 line
Himanshu Madhani Oracle Linux Engineering