diff mbox series

[v2,02/29] include: scsi: scsi_transport_fc: Match HBA Attribute Length with HBAAPI V2.0 definitions

Message ID 20200713074645.126138-3-lee.jones@linaro.org (mailing list archive)
State Accepted
Headers show
Series Fix a bunch more SCSI related W=1 warnings | expand

Commit Message

Lee Jones July 13, 2020, 7:46 a.m. UTC
According to 'include/scsi/scsi_transport_fc.h':

 "Attributes are based on HBAAPI V2.0 definitions"

... so it seems sane to match the 'HBA Attribute Length' to them.

If we don't, the compiler complains that the copied data will be truncated.

Fixes the following W=1 kernel build warning(s):

 In file included from include/linux/bitmap.h:9,
 from include/linux/cpumask.h:12,
 from include/linux/smp.h:13,
 from include/linux/percpu.h:7,
 from include/scsi/libfc.h:13,
 from drivers/scsi/libfc/fc_elsct.c:17:
 In function ‘strncpy’,
 inlined from ‘fc_ct_ms_fill.constprop’ at include/scsi/fc_encode.h:263:3:
 include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ output may be truncated copying 64 bytes from a string of length  79 [-Wstringop-truncation]
 297 | #define __underlying_strncpy __builtin_strncpy
 | ^
 include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
 307 | return __underlying_strncpy(p, q, size);
 | ^~~~~~~~~~~~~~~~~~~~
 In function ‘strncpy’,
 inlined from ‘fc_ct_ms_fill.constprop’ at include/scsi/fc_encode.h:275:3:
 include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ output may be truncated copying 64 bytes from a string of length 79 [-Wstringop-truncation]
 297 | #define __underlying_strncpy __builtin_strncpy
 | ^
 include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
 307 | return __underlying_strncpy(p, q, size);
 | ^~~~~~~~~~~~~~~~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 include/scsi/fc/fc_ms.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Hannes Reinecke July 14, 2020, 6:49 a.m. UTC | #1
On 7/13/20 9:46 AM, Lee Jones wrote:
> According to 'include/scsi/scsi_transport_fc.h':
> 
>   "Attributes are based on HBAAPI V2.0 definitions"
> 
> ... so it seems sane to match the 'HBA Attribute Length' to them.
> 
> If we don't, the compiler complains that the copied data will be truncated.
> 
> Fixes the following W=1 kernel build warning(s):
> 
>   In file included from include/linux/bitmap.h:9,
>   from include/linux/cpumask.h:12,
>   from include/linux/smp.h:13,
>   from include/linux/percpu.h:7,
>   from include/scsi/libfc.h:13,
>   from drivers/scsi/libfc/fc_elsct.c:17:
>   In function ‘strncpy’,
>   inlined from ‘fc_ct_ms_fill.constprop’ at include/scsi/fc_encode.h:263:3:
>   include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ output may be truncated copying 64 bytes from a string of length  79 [-Wstringop-truncation]
>   297 | #define __underlying_strncpy __builtin_strncpy
>   | ^
>   include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
>   307 | return __underlying_strncpy(p, q, size);
>   | ^~~~~~~~~~~~~~~~~~~~
>   In function ‘strncpy’,
>   inlined from ‘fc_ct_ms_fill.constprop’ at include/scsi/fc_encode.h:275:3:
>   include/linux/string.h:297:30: warning: ‘__builtin_strncpy’ output may be truncated copying 64 bytes from a string of length 79 [-Wstringop-truncation]
>   297 | #define __underlying_strncpy __builtin_strncpy
>   | ^
>   include/linux/string.h:307:9: note: in expansion of macro ‘__underlying_strncpy’
>   307 | return __underlying_strncpy(p, q, size);
>   | ^~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>   include/scsi/fc/fc_ms.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h
> index 800d53dc94705..9e273fed0a85f 100644
> --- a/include/scsi/fc/fc_ms.h
> +++ b/include/scsi/fc/fc_ms.h
> @@ -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	64
> -#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	64
> +#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	80
> +#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	80
>   #define FC_FDMI_HBA_ATTR_MODEL_LEN		256
>   #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN		256
>   #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN	256
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h
index 800d53dc94705..9e273fed0a85f 100644
--- a/include/scsi/fc/fc_ms.h
+++ b/include/scsi/fc/fc_ms.h
@@ -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	64
-#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	64
+#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	80
+#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	80
 #define FC_FDMI_HBA_ATTR_MODEL_LEN		256
 #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN		256
 #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN	256