Re: [PATCH 1/4] bpf: Add pin_name into struct bpf_prog_aux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 12, 2022 at 1:59 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Yafang,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on bpf/master]
> [also build test WARNING on net/master horms-ipvs/master net-next/master v5.17-rc3 next-20220211]
> [cannot apply to bpf-next/master]
> [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/0day-ci/linux/commits/Yafang-Shao/bpf-Add-more-information-into-bpffs/20220211-201319
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf.git master
> config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220211/202202112213.WGiJCCYD-lkp@xxxxxxxxx/config)
> compiler: arceb-elf-gcc (GCC) 11.2.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/0day-ci/linux/commit/6cd35bc70f99caee380d84f5ba9256ac5fe03860
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Yafang-Shao/bpf-Add-more-information-into-bpffs/20220211-201319
>         git checkout 6cd35bc70f99caee380d84f5ba9256ac5fe03860
>         # save the config file to linux build tree
>         mkdir build_dir
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash kernel/bpf/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
>    kernel/bpf/inode.c: In function 'bpf_obj_do_pin':
> >> kernel/bpf/inode.c:469:24: warning: ignoring return value of 'strncpy_from_user' declared with attribute 'warn_unused_result' [-Wunused-result]
>      469 |                 (void) strncpy_from_user(aux->pin_name, pathname, BPF_PIN_NAME_LEN);
>          |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>

Thanks for the report.
I will improve it to avoid this warning.

>
> vim +469 kernel/bpf/inode.c
>
>    437
>    438  static int bpf_obj_do_pin(const char __user *pathname, void *raw,
>    439                            enum bpf_type type)
>    440  {
>    441          struct bpf_prog_aux *aux;
>    442          struct bpf_prog *prog;
>    443          struct dentry *dentry;
>    444          struct inode *dir;
>    445          struct path path;
>    446          umode_t mode;
>    447          int ret;
>    448
>    449          dentry = user_path_create(AT_FDCWD, pathname, &path, 0);
>    450          if (IS_ERR(dentry))
>    451                  return PTR_ERR(dentry);
>    452
>    453          mode = S_IFREG | ((S_IRUSR | S_IWUSR) & ~current_umask());
>    454
>    455          ret = security_path_mknod(&path, dentry, mode, 0);
>    456          if (ret)
>    457                  goto out;
>    458
>    459          dir = d_inode(path.dentry);
>    460          if (dir->i_op != &bpf_dir_iops) {
>    461                  ret = -EPERM;
>    462                  goto out;
>    463          }
>    464
>    465          switch (type) {
>    466          case BPF_TYPE_PROG:
>    467                  prog = raw;
>    468                  aux = prog->aux;
>  > 469                  (void) strncpy_from_user(aux->pin_name, pathname, BPF_PIN_NAME_LEN);
>    470                  aux->pin_name[BPF_PIN_NAME_LEN - 1] = '\0';
>    471                  ret = vfs_mkobj(dentry, mode, bpf_mkprog, raw);
>    472                  break;
>    473          case BPF_TYPE_MAP:
>    474                  ret = vfs_mkobj(dentry, mode, bpf_mkmap, raw);
>    475                  break;
>    476          case BPF_TYPE_LINK:
>    477                  ret = vfs_mkobj(dentry, mode, bpf_mklink, raw);
>    478                  break;
>    479          default:
>    480                  ret = -EPERM;
>    481          }
>    482  out:
>    483          done_path_create(&path, dentry);
>    484          return ret;
>    485  }
>    486
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx



-- 
Thanks
Yafang



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux