[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB50898B7C5A2F51A42B9F07D7D6339@CO1PR11MB5089.namprd11.prod.outlook.com>
Date: Mon, 14 Feb 2022 18:16:56 +0000
From: "Keller, Jacob E" <jacob.e.keller@...el.com>
To: "trix@...hat.com" <trix@...hat.com>,
"Brandeburg, Jesse" <jesse.brandeburg@...el.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"kuba@...nel.org" <kuba@...nel.org>,
"nathan@...nel.org" <nathan@...nel.org>,
"ndesaulniers@...gle.com" <ndesaulniers@...gle.com>
CC: "intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"llvm@...ts.linux.dev" <llvm@...ts.linux.dev>
Subject: RE: [PATCH] ice: check the return of ice_ptp_gettimex64
> -----Original Message-----
> From: trix@...hat.com <trix@...hat.com>
> Sent: Monday, February 14, 2022 6:33 AM
> To: Brandeburg, Jesse <jesse.brandeburg@...el.com>; Nguyen, Anthony L
> <anthony.l.nguyen@...el.com>; davem@...emloft.net; kuba@...nel.org;
> nathan@...nel.org; ndesaulniers@...gle.com; Keller, Jacob E
> <jacob.e.keller@...el.com>
> Cc: intel-wired-lan@...ts.osuosl.org; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org; llvm@...ts.linux.dev; Tom Rix <trix@...hat.com>
> Subject: [PATCH] ice: check the return of ice_ptp_gettimex64
>
> From: Tom Rix <trix@...hat.com>
>
> Clang static analysis reports this issue
> time64.h:69:50: warning: The left operand of '+'
> is a garbage value
> set_normalized_timespec64(&ts_delta, lhs.tv_sec + rhs.tv_sec,
> ~~~~~~~~~~ ^
> In ice_ptp_adjtime_nonatomic(), the timespec64 variable 'now'
> is set by ice_ptp_gettimex64(). This function can fail
> with -EBUSY, so 'now' can have a gargbage value.
> So check the return.
>
> Fixes: 06c16d89d2cb ("ice: register 1588 PTP clock device object for E810 devices")
> Signed-off-by: Tom Rix <trix@...hat.com>
Ahhh yep. Good fix. Thanks!
> ---
> drivers/net/ethernet/intel/ice/ice_ptp.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c
> b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index ae291d442539..000c39d163a2 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -1533,9 +1533,12 @@ ice_ptp_settime64(struct ptp_clock_info *info, const
> struct timespec64 *ts)
> static int ice_ptp_adjtime_nonatomic(struct ptp_clock_info *info, s64 delta)
> {
> struct timespec64 now, then;
> + int ret;
>
> then = ns_to_timespec64(delta);
> - ice_ptp_gettimex64(info, &now, NULL);
> + ret = ice_ptp_gettimex64(info, &now, NULL);
> + if (ret)
> + return ret;
> now = timespec64_add(now, then);
>
> return ice_ptp_settime64(info, (const struct timespec64 *)&now);
> --
> 2.26.3
Powered by blists - more mailing lists