Thread (8 messages) 8 messages, 4 authors, 2022-10-11

Re: [PATCH net-next v5 1/4] devlink: Extend devlink-rate api with export functions and new params

From: kernel test robot <hidden>
Date: 2022-10-11 11:33:48

Hi Michal,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    https://github.com/intel-lab-lkp/linux/commits/Michal-Wilczynski/Implement-devlink-rate-API-and-extend-it/20221011-170316
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 0326074ff4652329f2a1a9c8685104576bd8d131
config: parisc-allyesconfig
compiler: hppa-linux-gcc (GCC) 12.1.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/8d3ddd5d449e069d832a772c6c1c9612023982bc
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Michal-Wilczynski/Implement-devlink-rate-API-and-extend-it/20221011-170316
        git checkout 8d3ddd5d449e069d832a772c6c1c9612023982bc
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=parisc SHELL=/bin/bash net/core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot [off-list ref]

All warnings (new ones prefixed by >>):

   net/core/devlink.c: In function 'devl_rate_node_create':
quoted
net/core/devlink.c:10314:9: warning: 'strncpy' specified bound 30 equals destination size [-Wstringop-truncation]
   10314 |         strncpy(rate_node->name, node_name, DEVLINK_RATE_NAME_MAX_LEN);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/strncpy +10314 net/core/devlink.c

 10275	
 10276	/**
 10277	 * devl_rate_node_create - create devlink rate node
 10278	 * @devlink: devlink instance
 10279	 * @priv: driver private data
 10280	 * @node_name: name of the resulting node
 10281	 * @parent_name: name of the parent of the resultion node
 10282	 *
 10283	 * Create devlink rate object of type node
 10284	 */
 10285	int devl_rate_node_create(struct devlink *devlink, void *priv, char *node_name, char *parent_name)
 10286	{
 10287		struct devlink_rate *rate_node;
 10288		struct devlink_rate *parent;
 10289	
 10290		rate_node = devlink_rate_node_get_by_name(devlink, node_name);
 10291		if (!IS_ERR(rate_node))
 10292			return -EEXIST;
 10293	
 10294		rate_node = kzalloc(sizeof(*rate_node), GFP_KERNEL);
 10295		if (!rate_node)
 10296			return -ENOMEM;
 10297	
 10298		if (parent_name) {
 10299			parent = devlink_rate_node_get_by_name(devlink, parent_name);
 10300			if (IS_ERR(parent))
 10301				return -ENODEV;
 10302			rate_node->parent = parent;
 10303			refcount_inc(&rate_node->parent->refcnt);
 10304		}
 10305	
 10306		rate_node->type = DEVLINK_RATE_TYPE_NODE;
 10307		rate_node->devlink = devlink;
 10308		rate_node->priv = priv;
 10309	
 10310		rate_node->name = kzalloc(DEVLINK_RATE_NAME_MAX_LEN, GFP_KERNEL);
 10311		if (!rate_node->name)
 10312			return -ENOMEM;
 10313	
 10314		strncpy(rate_node->name, node_name, DEVLINK_RATE_NAME_MAX_LEN);
 10315	
 10316		refcount_set(&rate_node->refcnt, 1);
 10317		list_add(&rate_node->list, &devlink->rate_list);
 10318		devlink_rate_notify(rate_node, DEVLINK_CMD_RATE_NEW);
 10319		return 0;
 10320	}
 10321	EXPORT_SYMBOL_GPL(devl_rate_node_create);
 10322	

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

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help