public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Weikang shi <swkhack@gmail.com>
To: john.stultz@linaro.org
Cc: tglx@linutronix.de, sboyd@kernel.org,
	linux-kernel@vger.kernel.org, swkhack@qq.com,
	swkhack <swkhack@gmail.com>
Subject: [PATCH] time: fix a assignment error in ntp module
Date: Mon, 22 Apr 2019 17:34:21 +0800	[thread overview]
Message-ID: <20190422093421.47896-1-swkhack@gmail.com> (raw)

From: swkhack <swkhack@gmail.com>

It is meanless to check a 64bit(txc->constant) value is postive 
when the value has to be assigned to a 32 bit variable(*time_tai).
So I make a temp type conversion before the compare.

Signed-off-by: swkhack <swkhack@gmail.com>
---
 kernel/time/ntp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 92a90014a..6b454eafc 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -690,7 +690,7 @@ static inline void process_adjtimex_modes(const struct __kernel_timex *txc,
 		time_constant = max(time_constant, 0l);
 	}
 
-	if (txc->modes & ADJ_TAI && txc->constant > 0)
+	if (txc->modes & ADJ_TAI && (int)txc->constant > 0)
 		*time_tai = txc->constant;
 
 	if (txc->modes & ADJ_OFFSET)
-- 
2.17.1


             reply	other threads:[~2019-04-22  9:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-22  9:34 Weikang shi [this message]
2019-04-24 20:22 ` [PATCH] time: fix a assignment error in ntp module Thomas Gleixner
2019-06-17  7:21 ` Thomas Gleixner
     [not found]   ` <CAObeVcdBDbSiyQCX7C_G3p6TpB9yjRyrWwsvPgh11V8v+BNaqQ@mail.gmail.com>
2019-06-17 12:14     ` Thomas Gleixner
2019-06-17 13:21       ` Miroslav Lichvar
2019-06-17 15:06         ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190422093421.47896-1-swkhack@gmail.com \
    --to=swkhack@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=swkhack@qq.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox