Netdev List
 help / color / mirror / Atom feed
From: kbuild test robot <fengguang.wu@intel.com>
To: Martin KaFai Lau <kafai@fb.com>
Cc: kbuild-all@01.org, netdev@vger.kernel.org
Subject: [net-next:master 332/339] kernel//bpf/syscall.c:1404:23: warning: cast to pointer from integer of different size
Date: Fri, 29 Sep 2017 14:54:16 +0800	[thread overview]
Message-ID: <201709291413.dQfHazqk%fengguang.wu@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3572 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   fa8fefaa678ea390b873195d19c09930da84a4bb
commit: cb4d2b3f03d8eed90be3a194e5b54b734ec4bbe9 [332/339] bpf: Add name, load_time, uid and map_ids to bpf_prog_info
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout cb4d2b3f03d8eed90be3a194e5b54b734ec4bbe9
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All warnings (new ones prefixed by >>):

   kernel//bpf/syscall.c: In function 'bpf_prog_get_info_by_fd':
>> kernel//bpf/syscall.c:1404:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
      u32 *user_map_ids = (u32 *)info.map_ids;
                          ^

vim +1404 kernel//bpf/syscall.c

  1371	
  1372	static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
  1373					   const union bpf_attr *attr,
  1374					   union bpf_attr __user *uattr)
  1375	{
  1376		struct bpf_prog_info __user *uinfo = u64_to_user_ptr(attr->info.info);
  1377		struct bpf_prog_info info = {};
  1378		u32 info_len = attr->info.info_len;
  1379		char __user *uinsns;
  1380		u32 ulen;
  1381		int err;
  1382	
  1383		err = check_uarg_tail_zero(uinfo, sizeof(info), info_len);
  1384		if (err)
  1385			return err;
  1386		info_len = min_t(u32, sizeof(info), info_len);
  1387	
  1388		if (copy_from_user(&info, uinfo, info_len))
  1389			return -EFAULT;
  1390	
  1391		info.type = prog->type;
  1392		info.id = prog->aux->id;
  1393		info.load_time = prog->aux->load_time;
  1394		info.created_by_uid = from_kuid_munged(current_user_ns(),
  1395						       prog->aux->user->uid);
  1396	
  1397		memcpy(info.tag, prog->tag, sizeof(prog->tag));
  1398		memcpy(info.name, prog->aux->name, sizeof(prog->aux->name));
  1399	
  1400		ulen = info.nr_map_ids;
  1401		info.nr_map_ids = prog->aux->used_map_cnt;
  1402		ulen = min_t(u32, info.nr_map_ids, ulen);
  1403		if (ulen) {
> 1404			u32 *user_map_ids = (u32 *)info.map_ids;
  1405			u32 i;
  1406	
  1407			for (i = 0; i < ulen; i++)
  1408				if (put_user(prog->aux->used_maps[i]->id,
  1409					     &user_map_ids[i]))
  1410					return -EFAULT;
  1411		}
  1412	
  1413		if (!capable(CAP_SYS_ADMIN)) {
  1414			info.jited_prog_len = 0;
  1415			info.xlated_prog_len = 0;
  1416			goto done;
  1417		}
  1418	
  1419		ulen = info.jited_prog_len;
  1420		info.jited_prog_len = prog->jited_len;
  1421		if (info.jited_prog_len && ulen) {
  1422			uinsns = u64_to_user_ptr(info.jited_prog_insns);
  1423			ulen = min_t(u32, info.jited_prog_len, ulen);
  1424			if (copy_to_user(uinsns, prog->bpf_func, ulen))
  1425				return -EFAULT;
  1426		}
  1427	
  1428		ulen = info.xlated_prog_len;
  1429		info.xlated_prog_len = bpf_prog_insn_size(prog);
  1430		if (info.xlated_prog_len && ulen) {
  1431			uinsns = u64_to_user_ptr(info.xlated_prog_insns);
  1432			ulen = min_t(u32, info.xlated_prog_len, ulen);
  1433			if (copy_to_user(uinsns, prog->insnsi, ulen))
  1434				return -EFAULT;
  1435		}
  1436	
  1437	done:
  1438		if (copy_to_user(uinfo, &info, info_len) ||
  1439		    put_user(info_len, &uattr->info.info_len))
  1440			return -EFAULT;
  1441	
  1442		return 0;
  1443	}
  1444	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 45901 bytes --]

             reply	other threads:[~2017-09-29  6:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-29  6:54 kbuild test robot [this message]
2017-09-29 17:04 ` [net-next:master 332/339] kernel//bpf/syscall.c:1404:23: warning: cast to pointer from integer of different size Martin KaFai Lau

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=201709291413.dQfHazqk%fengguang.wu@intel.com \
    --to=fengguang.wu@intel.com \
    --cc=kafai@fb.com \
    --cc=kbuild-all@01.org \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox