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]
Message-Id: <20221108235116.3522941-3-anthony.l.nguyen@intel.com>
Date:   Tue,  8 Nov 2022 15:51:15 -0800
From:   Tony Nguyen <anthony.l.nguyen@...el.com>
To:     davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
        edumazet@...gle.com
Cc:     Jacob Keller <jacob.e.keller@...el.com>, netdev@...r.kernel.org,
        anthony.l.nguyen@...el.com, richardcochran@...il.com,
        Gurucharan G <gurucharanx.g@...el.com>
Subject: [PATCH net 2/3] ice: use int for n_per_out loop

From: Jacob Keller <jacob.e.keller@...el.com>

In ice_ptp_enable_all_clkout and ice_ptp_disable_all_clkout we use a uint
for a for loop iterating over the n_per_out value from the struct
ptp_clock_info. The struct member is a signed int, and the use of uint
generates a -Wsign-compare warning:

  drivers/net/ethernet/intel/ice/ice_ptp.c: In function ‘ice_ptp_enable_all_clkout’:
  drivers/net/ethernet/intel/ice/ice_ptp.c:1710:23: error: comparison of integer expressions of different signedness: ‘uint’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
   1710 |         for (i = 0; i < pf->ptp.info.n_per_out; i++)
        |                       ^
  cc1: all warnings being treated as errors

While we don't generally compile with -Wsign-compare, its still a good idea
not to mix types. Fix the two functions to use a plain signed integer.

Fixes: 9ee313433c48 ("ice: restart periodic outputs around time changes")
Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
Tested-by: Gurucharan G <gurucharanx.g@...el.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 011b727ab190..be147fb641ae 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -1688,7 +1688,7 @@ static int ice_ptp_cfg_clkout(struct ice_pf *pf, unsigned int chan,
  */
 static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
 {
-	uint i;
+	int i;
 
 	for (i = 0; i < pf->ptp.info.n_per_out; i++)
 		if (pf->ptp.perout_channels[i].ena)
@@ -1705,7 +1705,7 @@ static void ice_ptp_disable_all_clkout(struct ice_pf *pf)
  */
 static void ice_ptp_enable_all_clkout(struct ice_pf *pf)
 {
-	uint i;
+	int i;
 
 	for (i = 0; i < pf->ptp.info.n_per_out; i++)
 		if (pf->ptp.perout_channels[i].ena)
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ