Message ID | 20220616235727.36546-1-huzh@nyu.edu (mailing list archive) |
---|---|
State | Rejected |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Fix Fortify String build warnings caused by the memcpy check in hinic_devlink.c. | expand |
On Thu, 16 Jun 2022 19:57:27 -0400 HighW4y2H3ll <huzh@nyu.edu> wrote: > ... > memcpy(&host_image->image_section_info[i], > &fw_image->fw_section_info[i], > sizeof(struct fw_section_info_st)); > ... > --- > drivers/net/ethernet/huawei/hinic/hinic_devlink.h | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/huawei/hinic/hinic_devlink.h b/drivers/net/ethernet/huawei/hinic/hinic_devlink.h > index 46760d607b9b..d7b26830c9ee 100644 > --- a/drivers/net/ethernet/huawei/hinic/hinic_devlink.h > +++ b/drivers/net/ethernet/huawei/hinic/hinic_devlink.h > @@ -92,14 +92,20 @@ struct fw_image_st { > u32 fw_section_cnt:16; > u32 resd:16; > } fw_info; > - struct fw_section_info_st fw_section_info[MAX_FW_TYPE_NUM]; > + union { > + struct_group(info, fw_section_info_st fw_section_info[0];); > + struct fw_section_info_st __data[MAX_FW_TYPE_NUM]; > + }; > u32 device_id; > u32 res[101]; > void *bin_data; > }; > > struct host_image_st { > - struct fw_section_info_st image_section_info[MAX_FW_TYPE_NUM]; > + union { > + struct_group(info, fw_section_info_st image_section_info[0];); > + struct fw_section_info_st __data[MAX_FW_TYPE_NUM]; > + }; > struct { > u32 up_total_len; > u32 fw_version; Patch is missing signed-of-by Using [0] inside union will cause warnings in future since you are referencing outside of bounds of array. Also indentation is wrong, you need to indent the union
On Thu, 16 Jun 2022 20:12:16 -0700 Stephen Hemminger wrote: > Patch is missing signed-of-by > > Using [0] inside union will cause warnings in future since you are referencing > outside of bounds of array. > > Also indentation is wrong, you need to indent the union BTW there's already a fix from Kees pending for this.
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_devlink.h b/drivers/net/ethernet/huawei/hinic/hinic_devlink.h index 46760d607b9b..d7b26830c9ee 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_devlink.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_devlink.h @@ -92,14 +92,20 @@ struct fw_image_st { u32 fw_section_cnt:16; u32 resd:16; } fw_info; - struct fw_section_info_st fw_section_info[MAX_FW_TYPE_NUM]; + union { + struct_group(info, fw_section_info_st fw_section_info[0];); + struct fw_section_info_st __data[MAX_FW_TYPE_NUM]; + }; u32 device_id; u32 res[101]; void *bin_data; }; struct host_image_st { - struct fw_section_info_st image_section_info[MAX_FW_TYPE_NUM]; + union { + struct_group(info, fw_section_info_st image_section_info[0];); + struct fw_section_info_st __data[MAX_FW_TYPE_NUM]; + }; struct { u32 up_total_len; u32 fw_version;