public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] time: fix a assignment error in ntp module
@ 2019-04-22  9:34 Weikang shi
  2019-04-24 20:22 ` Thomas Gleixner
  2019-06-17  7:21 ` Thomas Gleixner
  0 siblings, 2 replies; 6+ messages in thread
From: Weikang shi @ 2019-04-22  9:34 UTC (permalink / raw)
  To: john.stultz; +Cc: tglx, sboyd, linux-kernel, swkhack, swkhack

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


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

end of thread, other threads:[~2019-06-17 15:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-22  9:34 [PATCH] time: fix a assignment error in ntp module Weikang shi
2019-04-24 20:22 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox