public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Xia Fukun <xiafukun@huawei.com>,
	gregkh@linuxfoundation.org, prajnoha@redhat.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	linux-kernel@vger.kernel.org, xiafukun@huawei.com
Subject: Re: [PATCH v4] kobject: Fix global-out-of-bounds in kobject_action_type()
Date: Sat, 13 May 2023 00:20:21 +0800	[thread overview]
Message-ID: <202305130013.em3umwVP-lkp@intel.com> (raw)
In-Reply-To: <20230512103029.183852-1-xiafukun@huawei.com>

Hi Xia,

kernel test robot noticed the following build errors:

[auto build test ERROR on driver-core/driver-core-testing]
[also build test ERROR on driver-core/driver-core-next driver-core/driver-core-linus linus/master v6.4-rc1 next-20230512]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Xia-Fukun/kobject-Fix-global-out-of-bounds-in-kobject_action_type/20230512-183414
base:   driver-core/driver-core-testing
patch link:    https://lore.kernel.org/r/20230512103029.183852-1-xiafukun%40huawei.com
patch subject: [PATCH v4] kobject: Fix global-out-of-bounds in kobject_action_type()
config: x86_64-randconfig-a001 (https://download.01.org/0day-ci/archive/20230513/202305130013.em3umwVP-lkp@intel.com/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/4d1d5546395a3bf45324f25b5e77b90fe6cfe8df
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Xia-Fukun/kobject-Fix-global-out-of-bounds-in-kobject_action_type/20230512-183414
        git checkout 4d1d5546395a3bf45324f25b5e77b90fe6cfe8df
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305130013.em3umwVP-lkp@intel.com/

All errors (new ones prefixed by >>):

>> lib/kobject_uevent.c:90:11: error: implicit declaration of function 'kobject_action' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           action = kobject_action(i);
                    ^
   lib/kobject_uevent.c:67:9: warning: variable 'count_first' set but not used [-Wunused-but-set-variable]
           size_t count_first;
                  ^
   1 warning and 1 error generated.


vim +/kobject_action +90 lib/kobject_uevent.c

    61	
    62	static int kobject_action_type(const char *buf, size_t count,
    63				       enum kobject_action *type,
    64				       const char **args)
    65	{
    66		enum kobject_action action;
    67		size_t count_first;
    68		const char *args_start;
    69		int i, ret = -EINVAL;
    70	
    71		if (count && (buf[count-1] == '\n' || buf[count-1] == '\0'))
    72			count--;
    73	
    74		if (!count)
    75			goto out;
    76	
    77		args_start = strnchr(buf, count, ' ');
    78		if (args_start) {
    79			count_first = args_start - buf;
    80			args_start = args_start + 1;
    81		} else
    82			count_first = count;
    83	
    84		/* Use sysfs_match_string() to replace the fragile and convoluted loop */
    85		i = sysfs_match_string(kobject_actions, buf);
    86	
    87		if (i < 0)
    88			return ret;
    89	
  > 90		action = kobject_action(i);
    91	
    92		if (args)
    93			*args = args_start;
    94	
    95		*type = action;
    96		ret = 0;
    97	
    98	out:
    99		return ret;
   100	}
   101	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

  reply	other threads:[~2023-05-12 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12 10:30 [PATCH v4] kobject: Fix global-out-of-bounds in kobject_action_type() Xia Fukun
2023-05-12 16:20 ` kernel test robot [this message]
2023-05-12 16:51 ` kernel test robot
2023-05-13  9:33 ` Greg KH
2023-05-16  1:37   ` Xia Fukun

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=202305130013.em3umwVP-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=prajnoha@redhat.com \
    --cc=xiafukun@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