Return-Path: Received: from mail-sn1nam01on0094.outbound.protection.outlook.com ([104.47.32.94]:45235 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1031929AbeCAPYZ (ORCPT ); Thu, 1 Mar 2018 10:24:25 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Emil Tantilov , Jeff Kirsher , Sasha Levin Subject: [added to the 4.1 stable tree] ixgbe: fix use of uninitialized padding Date: Thu, 1 Mar 2018 15:22:58 +0000 Message-ID: <20180301152116.1486-51-alexander.levin@microsoft.com> References: <20180301152116.1486-1-alexander.levin@microsoft.com> In-Reply-To: <20180301152116.1486-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Emil Tantilov This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit dcfd6b839c998bc9838e2a47f44f37afbdf3099c ] This patch is resolving Coverity hits where padding in a structure could be used uninitialized. - Initialize fwd_cmd.pad/2 before ixgbe_calculate_checksum() - Initialize buffer.pad2/3 before ixgbe_hic_unlocked() Signed-off-by: Emil Tantilov Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 4 ++-- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/= ethernet/intel/ixgbe/ixgbe_common.c index 06d8f3cfa099..14f789e72c29 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c @@ -3609,10 +3609,10 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *h= w, u8 maj, u8 min, fw_cmd.ver_build =3D build; fw_cmd.ver_sub =3D sub; fw_cmd.hdr.checksum =3D 0; - fw_cmd.hdr.checksum =3D ixgbe_calculate_checksum((u8 *)&fw_cmd, - (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); fw_cmd.pad =3D 0; fw_cmd.pad2 =3D 0; + fw_cmd.hdr.checksum =3D ixgbe_calculate_checksum((u8 *)&fw_cmd, + (FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len)); =20 for (i =3D 0; i <=3D FW_CEM_MAX_RETRIES; i++) { ret_val =3D ixgbe_host_interface_command(hw, (u32 *)&fw_cmd, diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/et= hernet/intel/ixgbe/ixgbe_x550.c index cf5cf819a6b8..0e1e63ee6c5e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c @@ -224,6 +224,8 @@ static s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgb= e_hw *hw, /* convert offset from words to bytes */ buffer.address =3D cpu_to_be32((offset + current_word) * 2); buffer.length =3D cpu_to_be16(words_to_read * 2); + buffer.pad2 =3D 0; + buffer.pad3 =3D 0; =20 status =3D ixgbe_host_interface_command(hw, (u32 *)&buffer, sizeof(buffer), --=20 2.14.1