lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Jun 2022 20:12:16 -0700
From:   Stephen Hemminger <stephen@...workplumber.org>
To:     HighW4y2H3ll <huzh@....edu>
Cc:     netdev@...r.kernel.org
Subject: Re: [PATCH] Fix Fortify String build warnings caused by the memcpy
 check in hinic_devlink.c.

On Thu, 16 Jun 2022 19:57:27 -0400
HighW4y2H3ll <huzh@....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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ