All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Saud Farooqui <farooqui_saud@hotmail.com>,
	bjorn.andersson@linaro.org, mathieu.poirier@linaro.org,
	linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kbuild-all@lists.01.org, Saud Farooqui <farooqui_saud@hotmail.com>
Subject: Re: [PATCH] rpmsg: strcpy is not safe, use strncpy
Date: Fri, 10 Jun 2022 05:08:46 +0800	[thread overview]
Message-ID: <202206100428.A3CCM24E-lkp@intel.com> (raw)
In-Reply-To: <PA4P189MB1421005C22E46EBD708EBA798BA49@PA4P189MB1421.EURP189.PROD.OUTLOOK.COM>

Hi Saud,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.19-rc1]
[also build test WARNING on next-20220609]
[cannot apply to remoteproc/rpmsg-next]
[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]

url:    https://github.com/intel-lab-lkp/linux/commits/Saud-Farooqui/rpmsg-strcpy-is-not-safe-use-strncpy/20220609-024555
base:    f2906aa863381afb0015a9eb7fefad885d4e5a56
config: sparc64-randconfig-r026-20220609 (https://download.01.org/0day-ci/archive/20220610/202206100428.A3CCM24E-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.3.0
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/b6e6a64ab89042911604aa4741584a422cdfe8a5
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Saud-Farooqui/rpmsg-strcpy-is-not-safe-use-strncpy/20220609-024555
        git checkout b6e6a64ab89042911604aa4741584a422cdfe8a5
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=sparc64 SHELL=/bin/bash drivers/rpmsg/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/rpmsg/rpmsg_core.c: In function 'rpmsg_register_device_override':
>> drivers/rpmsg/rpmsg_core.c:607:17: warning: 'strncpy' specified bound 32 equals destination size [-Wstringop-truncation]
     607 |                 strncpy(rpdev->id.name, driver_override, sizeof(rpdev->id.name));
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +607 drivers/rpmsg/rpmsg_core.c

   595	
   596	/*
   597	 * A helper for registering rpmsg device with driver override and name.
   598	 * Drivers should not be using it, but instead rpmsg_register_device().
   599	 */
   600	int rpmsg_register_device_override(struct rpmsg_device *rpdev,
   601					   const char *driver_override)
   602	{
   603		struct device *dev = &rpdev->dev;
   604		int ret;
   605	
   606		if (driver_override)
 > 607			strncpy(rpdev->id.name, driver_override, sizeof(rpdev->id.name));
   608	
   609		dev_set_name(dev, "%s.%s.%d.%d", dev_name(dev->parent),
   610			     rpdev->id.name, rpdev->src, rpdev->dst);
   611	
   612		dev->bus = &rpmsg_bus;
   613	
   614		device_initialize(dev);
   615		if (driver_override) {
   616			ret = driver_set_override(dev, &rpdev->driver_override,
   617						  driver_override,
   618						  strlen(driver_override));
   619			if (ret) {
   620				dev_err(dev, "device_set_override failed: %d\n", ret);
   621				return ret;
   622			}
   623		}
   624	
   625		ret = device_add(dev);
   626		if (ret) {
   627			dev_err(dev, "device_add failed: %d\n", ret);
   628			kfree(rpdev->driver_override);
   629			rpdev->driver_override = NULL;
   630			put_device(dev);
   631		}
   632	
   633		return ret;
   634	}
   635	EXPORT_SYMBOL(rpmsg_register_device_override);
   636	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

  reply	other threads:[~2022-06-09 21:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 18:43 [PATCH] rpmsg: strcpy is not safe, use strncpy Saud Farooqui
2022-06-09 21:08 ` kernel test robot [this message]
2022-06-22 17:46 ` Mathieu Poirier
2022-06-23  9:20   ` [PATCH v1] rpmsg: strcpy is not safe, use strscpy_pad() instead Saud Farooqui
2022-06-24 17:38     ` Mathieu Poirier

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=202206100428.A3CCM24E-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=farooqui_saud@hotmail.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.