public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: kbuild-all@lists.01.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org,
	Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: Re: [PATCH next 2/3] debugfs: introduce debugfs_create_single[,_data]
Date: Tue, 3 Dec 2019 11:38:47 +0300	[thread overview]
Message-ID: <20191203083847.GC1787@kadam> (raw)
In-Reply-To: <20191129092752.169902-3-wangkefeng.wang@huawei.com>

[ How do I fetch 0day git branchs?
  git fetch https://github.com/0day-ci/linux/commits/Kefeng-Wang/debugfs-introduce-debugfs_create_single-seq-_data/20191129-173440
  doesn't work. - dan ]

Hi Kefeng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on next-20191128]
[cannot apply to v5.4]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Kefeng-Wang/debugfs-introduce-debugfs_create_single-seq-_data/20191129-173440
base:    d26b0e226f222c22c3b7e9d16e5b886e7c51057a


If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
fs/debugfs/file.c:1193 debugfs_create_single_data() warn: overwrite may leak 'entry'

Old smatch warnings:
include/linux/compiler.h:247 __write_once_size() warn: potential memory corrupting cast 8 vs 4 bytes

# https://github.com/0day-ci/linux/commit/198a4ea9768d6790a169e8b802e702c208aafbd1
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 198a4ea9768d6790a169e8b802e702c208aafbd1
vim +/entry +1193 fs/debugfs/file.c

198a4ea9768d67 Kefeng Wang      2019-11-29  1179  struct dentry *debugfs_create_single_data(const char *name, umode_t mode,
198a4ea9768d67 Kefeng Wang      2019-11-29  1180  					  struct dentry *parent, void *data,
198a4ea9768d67 Kefeng Wang      2019-11-29  1181  					  int (*read_fn)(struct seq_file *s,
198a4ea9768d67 Kefeng Wang      2019-11-29  1182  							 void *data))
198a4ea9768d67 Kefeng Wang      2019-11-29  1183  {
198a4ea9768d67 Kefeng Wang      2019-11-29  1184  	struct debugfs_entry *entry;
198a4ea9768d67 Kefeng Wang      2019-11-29  1185  
198a4ea9768d67 Kefeng Wang      2019-11-29  1186  	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
198a4ea9768d67 Kefeng Wang      2019-11-29  1187  	if (!entry)
198a4ea9768d67 Kefeng Wang      2019-11-29  1188  		return ERR_PTR(-ENOMEM);
198a4ea9768d67 Kefeng Wang      2019-11-29  1189  
198a4ea9768d67 Kefeng Wang      2019-11-29  1190  	entry->read = read_fn;
198a4ea9768d67 Kefeng Wang      2019-11-29  1191  	entry->data = data;
198a4ea9768d67 Kefeng Wang      2019-11-29  1192  
198a4ea9768d67 Kefeng Wang      2019-11-29 @1193  	entry = debugfs_set_lowest_bit(entry);
                                                        ^^^^^^^^
I haven't looked at the surrounding code but how would we free "entry"
when we write over it here?

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

  reply	other threads:[~2019-12-03  8:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29  9:27 [PATCH next 0/3] debugfs: introduce debugfs_create_single/seq[,_data] Kefeng Wang
2019-11-29  9:27 ` [PATCH next 1/3] debugfs: Provide debugfs_[set|clear|test]_lowest_bit() Kefeng Wang
2019-11-29  9:27 ` [PATCH next 2/3] debugfs: introduce debugfs_create_single[,_data] Kefeng Wang
2019-12-03  8:38   ` Dan Carpenter [this message]
2019-12-03  9:02     ` [kbuild-all] " Rong Chen
2019-12-03  9:32       ` Dan Carpenter
2019-11-29  9:27 ` [PATCH next 3/3] debugfs: introduce debugfs_create_seq[,_data] Kefeng Wang
2019-11-29 14:22   ` Greg KH
2019-11-29 15:03     ` Kefeng Wang
2019-11-29 22:16       ` Greg KH
2019-11-29 14:21 ` [PATCH next 0/3] debugfs: introduce debugfs_create_single/seq[,_data] Greg KH
2019-11-29 15:16   ` Kefeng Wang
2019-11-29 22:19     ` Greg KH
2019-11-29 22:23       ` Greg KH

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=20191203083847.GC1787@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangkefeng.wang@huawei.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