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, 12 Oct 2023 10:12:24 +0000
From: "Pucha, HimasekharX Reddy" <himasekharx.reddy.pucha@...el.com>
To: "Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
	"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "Lobakin, Aleksander"
	<aleksander.lobakin@...el.com>, Christophe JAILLET
	<christophe.jaillet@...adoo.fr>, "Brandeburg, Jesse"
	<jesse.brandeburg@...el.com>, "Kitszel, Przemyslaw"
	<przemyslaw.kitszel@...el.com>
Subject: RE: [Intel-wired-lan] [PATCH iwl-next v1 1/2] intel: fix string
 truncation warnings

> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf Of Jesse Brandeburg
> Sent: Wednesday, October 4, 2023 12:06 AM
> To: intel-wired-lan@...ts.osuosl.org
> Cc: netdev@...r.kernel.org; Lobakin, Aleksander <aleksander.lobakin@...el.com>; Christophe JAILLET <christophe.jaillet@...adoo.fr>; Brandeburg, Jesse <jesse.brandeburg@...el.com>; Kitszel, Przemyslaw <przemyslaw.kitszel@...el.com>
> Subject: [Intel-wired-lan] [PATCH iwl-next v1 1/2] intel: fix string truncation warnings
>
> Fix -Wformat-truncated warnings to complete the intel directories' W=1
> clean efforts. The W=1 recently got enhanced with a few new flags and
> this brought up some new warnings.
>
> Switch to using kasprintf() when possible so we always allocate the
> right length strings.
>
> summary of warnings:
> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:60: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
> drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:17: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 13
> drivers/net/ethernet/intel/ice/ice_ptp.c:43:27: warning: ‘%s’ directive output may be truncated writing up to 479 bytes into a region of size 64 [-Wformat-truncation=]
> drivers/net/ethernet/intel/ice/ice_ptp.c:42:17: note: ‘snprintf’ output between 1 and 480 bytes into a destination of size 64
> drivers/net/ethernet/intel/igb/igb_main.c:3092:53: warning: ‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 13 [-Wformat-truncation=]
> drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
> drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
> drivers/net/ethernet/intel/igb/igb_main.c:3090:25: note: ‘snprintf’ output between 23 and 43 bytes into a destination of size 32
>
> Suggested-by: Alexander Lobakin <aleksander.lobakin@...el.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@...el.com>
> ---
> I thought this was fine to go to -next since there isn't really urgency
> to drive this change.
> ---
> /linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c: In function ‘iavf_virtchnl_completion’:
> /linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:60: warning: ‘%s’ directive output may be truncated writing 4 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
>  1425 |                 snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
>      |                                                            ^~
>  1426 |                          link_speed_mbps, "Mbps");
>       |                                           ~~~~~~
> /linux/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c:1425:17: note: ‘snprintf’ output between 7 and 17 bytes into a destination of size 13
>  1425 |                 snprintf(speed, IAVF_MAX_SPEED_STRLEN, "%d %s",
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  1426 |                          link_speed_mbps, "Mbps");
>       |                          ~~~~~~~~~~~~~~~~~~~~~~~~
> /linux/drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_get_sma_config_e810t’:
> /linux/drivers/net/ethernet/intel/ice/ice_ptp.c:43:27: warning: ‘%s’ directive output may be truncated writing up to 479 bytes into a region of size 64 [-Wformat-truncation=]
>    43 |                          "%s", ice_pin_desc_e810t[i].name);
>       |                           ^~
> /linux/drivers/net/ethernet/intel/ice/ice_ptp.c:42:17: note: ‘snprintf’ output between 1 and 480 bytes into a destination of size 64
>    42 |                 snprintf(ptp_pins[i].name, sizeof(ptp_pins[i].name),
>       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    43 |                          "%s", ice_pin_desc_e810t[i].name);
>       |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /linux/drivers/net/ethernet/intel/igb/igb_main.c: In function ‘igb_set_fw_version’:
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:53: warning: ‘%d’ directive output may be truncated writing between 1 and 5 bytes into a region of size between 1 and 13 [-Wformat-truncation=]
>  3092 |                                  "%d.%d, 0x%08x, %d.%d.%d",
>       |                                                     ^~
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
>  3092 |                                  "%d.%d, 0x%08x, %d.%d.%d",
>       |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3092:34: note: directive argument in the range [0, 65535]
> /linux/drivers/net/ethernet/intel/igb/igb_main.c:3090:25: note: ‘snprintf’ output between 23 and 43 bytes into a destination of size 32
>  3090 |                         snprintf(adapter->fw_version,
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  3091 |                                  sizeof(adapter->fw_version),
>       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  3092 |                                  "%d.%d, 0x%08x, %d.%d.%d",
>       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
>  3093 |                                  fw.eep_major, fw.eep_minor, fw.etrack_id,
>       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  3094 |                                  fw.or_major, fw.or_build, fw.or_patch);
>       |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ---
>  .../net/ethernet/intel/iavf/iavf_ethtool.c    |  4 +-
>  .../net/ethernet/intel/iavf/iavf_virtchnl.c   | 22 ++++-------
>  drivers/net/ethernet/intel/ice/ice_ptp.c      |  4 +-
>  drivers/net/ethernet/intel/igb/igb_main.c     | 37 +++++++++----------
>  4 files changed, 30 insertions(+), 37 deletions(-)
>

Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@...el.com> (A Contingent worker at Intel)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ