All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding
@ 2017-09-11 21:21 Emil Tantilov
  2017-09-11 21:21 ` [Intel-wired-lan] [PATCH 2/2] ixgbe: fix the FWSM.PT check in ixgbe_mng_present() Emil Tantilov
  2017-09-19 19:19 ` [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding Bowers, AndrewX
  0 siblings, 2 replies; 4+ messages in thread
From: Emil Tantilov @ 2017-09-11 21:21 UTC (permalink / raw)
  To: intel-wired-lan

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 <emil.s.tantilov@intel.com>
---
 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 2c19070..041940c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -3800,10 +3800,10 @@ s32 ixgbe_set_fw_drv_ver_generic(struct ixgbe_hw *hw, u8 maj, u8 min,
 	fw_cmd.ver_build = build;
 	fw_cmd.ver_sub = sub;
 	fw_cmd.hdr.checksum = 0;
-	fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd,
-				(FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len));
 	fw_cmd.pad = 0;
 	fw_cmd.pad2 = 0;
+	fw_cmd.hdr.checksum = ixgbe_calculate_checksum((u8 *)&fw_cmd,
+				(FW_CEM_HDR_LEN + fw_cmd.hdr.buf_len));
 
 	for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) {
 		ret_val = ixgbe_host_interface_command(hw, &fw_cmd,
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index 1974f8f..54cdbcd 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -1000,6 +1000,8 @@ static s32 ixgbe_read_ee_hostif_buffer_X550(struct ixgbe_hw *hw,
 		/* convert offset from words to bytes */
 		buffer.address = cpu_to_be32((offset + current_word) * 2);
 		buffer.length = cpu_to_be16(words_to_read * 2);
+		buffer.pad2 = 0;
+		buffer.pad3 = 0;
 
 		status = ixgbe_hic_unlocked(hw, (u32 *)&buffer, sizeof(buffer),
 					    IXGBE_HI_COMMAND_TIMEOUT);


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH 2/2] ixgbe: fix the FWSM.PT check in ixgbe_mng_present()
  2017-09-11 21:21 [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding Emil Tantilov
@ 2017-09-11 21:21 ` Emil Tantilov
  2017-09-19 19:19   ` Bowers, AndrewX
  2017-09-19 19:19 ` [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding Bowers, AndrewX
  1 sibling, 1 reply; 4+ messages in thread
From: Emil Tantilov @ 2017-09-11 21:21 UTC (permalink / raw)
  To: intel-wired-lan

Bits other than FWSM.PT can be set in IXGBE_SWFW_MODE_MASK making the
previous check invalid.

Change the check for MNG present to be only based on FWSM.PT bit.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index 041940c..4e5c92d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -4100,8 +4100,8 @@ bool ixgbe_mng_present(struct ixgbe_hw *hw)
 		return false;
 
 	fwsm = IXGBE_READ_REG(hw, IXGBE_FWSM(hw));
-	fwsm &= IXGBE_FWSM_MODE_MASK;
-	return fwsm == IXGBE_FWSM_FW_MODE_PT;
+
+	return !!(fwsm & IXGBE_FWSM_FW_MODE_PT);
 }
 
 /**


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding
  2017-09-11 21:21 [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding Emil Tantilov
  2017-09-11 21:21 ` [Intel-wired-lan] [PATCH 2/2] ixgbe: fix the FWSM.PT check in ixgbe_mng_present() Emil Tantilov
@ 2017-09-19 19:19 ` Bowers, AndrewX
  1 sibling, 0 replies; 4+ messages in thread
From: Bowers, AndrewX @ 2017-09-19 19:19 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Emil Tantilov
> Sent: Monday, September 11, 2017 2:22 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding
> 
> 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 <emil.s.tantilov@intel.com>
> ---
>  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(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH 2/2] ixgbe: fix the FWSM.PT check in ixgbe_mng_present()
  2017-09-11 21:21 ` [Intel-wired-lan] [PATCH 2/2] ixgbe: fix the FWSM.PT check in ixgbe_mng_present() Emil Tantilov
@ 2017-09-19 19:19   ` Bowers, AndrewX
  0 siblings, 0 replies; 4+ messages in thread
From: Bowers, AndrewX @ 2017-09-19 19:19 UTC (permalink / raw)
  To: intel-wired-lan

> -----Original Message-----
> From: Intel-wired-lan [mailto:intel-wired-lan-bounces at osuosl.org] On
> Behalf Of Emil Tantilov
> Sent: Monday, September 11, 2017 2:22 PM
> To: intel-wired-lan at lists.osuosl.org
> Subject: [Intel-wired-lan] [PATCH 2/2] ixgbe: fix the FWSM.PT check in
> ixgbe_mng_present()
> 
> Bits other than FWSM.PT can be set in IXGBE_SWFW_MODE_MASK making
> the previous check invalid.
> 
> Change the check for MNG present to be only based on FWSM.PT bit.
> 
> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_common.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Tested-by: Andrew Bowers <andrewx.bowers@intel.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-19 19:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-11 21:21 [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding Emil Tantilov
2017-09-11 21:21 ` [Intel-wired-lan] [PATCH 2/2] ixgbe: fix the FWSM.PT check in ixgbe_mng_present() Emil Tantilov
2017-09-19 19:19   ` Bowers, AndrewX
2017-09-19 19:19 ` [Intel-wired-lan] [PATCH 1/2] ixgbe: fix use of uninitialized padding Bowers, AndrewX

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.