* [PATCH] Fix Fortify String build warnings caused by the memcpy check in hinic_devlink.c.
@ 2022-06-16 23:57 HighW4y2H3ll
2022-06-17 3:12 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: HighW4y2H3ll @ 2022-06-16 23:57 UTC (permalink / raw)
To: netdev; +Cc: HighW4y2H3ll
...
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;
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Fix Fortify String build warnings caused by the memcpy check in hinic_devlink.c.
2022-06-16 23:57 [PATCH] Fix Fortify String build warnings caused by the memcpy check in hinic_devlink.c HighW4y2H3ll
@ 2022-06-17 3:12 ` Stephen Hemminger
2022-06-17 3:24 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2022-06-17 3:12 UTC (permalink / raw)
To: HighW4y2H3ll; +Cc: netdev
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] Fix Fortify String build warnings caused by the memcpy check in hinic_devlink.c.
2022-06-17 3:12 ` Stephen Hemminger
@ 2022-06-17 3:24 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-06-17 3:24 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: HighW4y2H3ll, netdev
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-17 3:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-16 23:57 [PATCH] Fix Fortify String build warnings caused by the memcpy check in hinic_devlink.c HighW4y2H3ll
2022-06-17 3:12 ` Stephen Hemminger
2022-06-17 3:24 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).