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: <20210120093233.GD20820@kadam>
Date:   Wed, 20 Jan 2021 12:32:33 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Yejune Deng <yejune.deng@...il.com>,
        john.stultz@...aro.org, tglx@...utronix.de, sboyd@...nel.org
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, yejune.deng@...il.com
Subject: [kbuild] Re: [PATCH] ntp: use memset and offsetof init

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@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.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 

Download attachment ".config.gz" of type "application/gzip" (31867 bytes)

_______________________________________________
kbuild mailing list -- kbuild@...ts.01.org
To unsubscribe send an email to kbuild-leave@...ts.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ