From: kernel test robot <lkp@intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: kbuild-all@lists.01.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: [driver-core:debugfs_cleanup 1/2] fs/d_path.c:59 prepend() warn: unsigned 'p->len' is never less than zero.
Date: Thu, 30 Sep 2021 12:17:32 +0800 [thread overview]
Message-ID: <202109301219.cZqUlzDk-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2517 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_cleanup
head: c4535d1b074f3fdd9476e83526d4e9b53f41a7b5
commit: 473082c5bbad92c5909ccf75fb28df699b94de82 [1/2] fs: make d_path-like functions all have unsigned size
config: i386-randconfig-m021-20210929 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
smatch warnings:
fs/d_path.c:59 prepend() warn: unsigned 'p->len' is never less than zero.
vim +59 fs/d_path.c
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 55
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 56 static bool prepend(struct prepend_buffer *p, const char *str, int namelen)
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 57 {
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 58 // Already overflowed?
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 @59 if (p->len < 0)
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 60 return false;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 61
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 62 // Will overflow?
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 63 if (p->len < namelen) {
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 64 // Fill as much as possible from the end of the name
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 65 str += namelen - p->len;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 66 p->buf -= p->len;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 67 prepend_copy(p->buf, str, p->len);
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 68 p->len = -1;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 69 return false;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 70 }
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 71
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 72 // Fits fully
ad08ae586586ea9 Al Viro 2021-05-12 73 p->len -= namelen;
ad08ae586586ea9 Al Viro 2021-05-12 74 p->buf -= namelen;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 75 return prepend_copy(p->buf, str, namelen);
7a5cf791a747640 Al Viro 2018-03-05 76 }
7a5cf791a747640 Al Viro 2018-03-05 77
:::::: The code at line 59 was first introduced by commit
:::::: b0cfcdd9b9672ea90642f33d6c0dd8516553adf2 d_path: make 'prepend()' fill up the buffer exactly on overflow
:::::: TO: Linus Torvalds <torvalds@linux-foundation.org>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
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: 35352 bytes --]
WARNING: multiple messages have this Message-ID
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org
Subject: [driver-core:debugfs_cleanup 1/2] fs/d_path.c:59 prepend() warn: unsigned 'p->len' is never less than zero.
Date: Thu, 30 Sep 2021 12:46:59 +0300 [thread overview]
Message-ID: <202109301219.cZqUlzDk-lkp@intel.com> (raw)
Message-ID: <20210930094659.H5ZE5JeQWARjCN4fNhDEuGQKefueHD0M2_53IcDJ2g4@z> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git debugfs_cleanup
head: c4535d1b074f3fdd9476e83526d4e9b53f41a7b5
commit: 473082c5bbad92c5909ccf75fb28df699b94de82 [1/2] fs: make d_path-like functions all have unsigned size
config: i386-randconfig-m021-20210929 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
smatch warnings:
fs/d_path.c:59 prepend() warn: unsigned 'p->len' is never less than zero.
vim +59 fs/d_path.c
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 56 static bool prepend(struct prepend_buffer *p, const char *str, int namelen)
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 57 {
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 58 // Already overflowed?
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 @59 if (p->len < 0)
This is impossible now.
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 60 return false;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 61
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 62 // Will overflow?
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 63 if (p->len < namelen) {
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 64 // Fill as much as possible from the end of the name
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 65 str += namelen - p->len;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 66 p->buf -= p->len;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 67 prepend_copy(p->buf, str, p->len);
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 68 p->len = -1;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 69 return false;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 70 }
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 71
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 72 // Fits fully
ad08ae586586ea9 Al Viro 2021-05-12 73 p->len -= namelen;
ad08ae586586ea9 Al Viro 2021-05-12 74 p->buf -= namelen;
b0cfcdd9b9672ea Linus Torvalds 2021-07-16 75 return prepend_copy(p->buf, str, namelen);
7a5cf791a747640 Al Viro 2018-03-05 76 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next reply other threads:[~2021-09-30 4:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 4:17 kernel test robot [this message]
2021-09-30 9:46 ` Dan Carpenter
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=202109301219.cZqUlzDk-lkp@intel.com \
--to=lkp@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®