From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Yejune Deng <yejune.deng@gmail.com>,
john.stultz@linaro.org, tglx@linutronix.de, sboyd@kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org, yejune.deng@gmail.com
Subject: [kbuild] Re: [PATCH] ntp: use memset and offsetof init
Date: Wed, 20 Jan 2021 12:32:33 +0300 [thread overview]
Message-ID: <20210120093233.GD20820@kadam> (raw)
In-Reply-To: <20210120025114.16294-1-yejune.deng@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1738 bytes --]
Hi Yejune,
url: https://github.com/0day-ci/linux/commits/Yejune-Deng/ntp-use-memset-and-offsetof-init/20210120-110830
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 3cabca87b329cbcbdf295be0094adbd72c7b1f67
config: i386-randconfig-m021-20210120 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
kernel/time/ntp.c:232 pps_fill_timex() warn: potential pointer math issue ('txc' is a 1664 bit pointer)
vim +232 kernel/time/ntp.c
ead25417f82ed7f8 Deepa Dinamani 2018-07-02 225 static inline void pps_fill_timex(struct __kernel_timex *txc)
025b40abe715d638 Alexander Gordeev 2011-01-12 226 {
025b40abe715d638 Alexander Gordeev 2011-01-12 227 /* PPS is not implemented, so these are zero */
a29bace5d3c06a35 Yejune Deng 2021-01-20 228 int offset, len;
a29bace5d3c06a35 Yejune Deng 2021-01-20 229
a29bace5d3c06a35 Yejune Deng 2021-01-20 230 offset = offsetof(struct __kernel_timex, ppsfreq);
a29bace5d3c06a35 Yejune Deng 2021-01-20 231 len = offsetof(struct __kernel_timex, tai) - offset;
a29bace5d3c06a35 Yejune Deng 2021-01-20 @232 memset(txc + offset, 0, len);
^^^^^^^^^^^^
The warning message is badly phrased. This needs to be:
memset((u8 *)txc + offset, 0, len);
The current code will corrupt memory if offset is non-zero.
025b40abe715d638 Alexander Gordeev 2011-01-12 233 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31867 bytes --]
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org
next prev parent reply other threads:[~2021-01-20 10:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 2:51 [PATCH] ntp: use memset and offsetof init Yejune Deng
2021-01-20 9:32 ` Dan Carpenter [this message]
2021-01-26 7:44 ` [ntp] a29bace5d3: BUG:Bad_rss-counter_state_mm:#type:MM_FILEPAGES_val kernel test robot
2021-02-05 17:33 ` [PATCH] ntp: use memset and offsetof init Thomas Gleixner
2021-02-08 9:28 ` David Laight
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=20210120093233.GD20820@kadam \
--to=dan.carpenter@oracle.com \
--cc=john.stultz@linaro.org \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=yejune.deng@gmail.com \
/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