All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kernel@openeuler.org, Dong Chenchen <dongchenchen2@huawei.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [openeuler:openEuler-1.0-LTS 1605/1605] net/ipv4/arp.c:1106:5: warning: comparison of distinct pointer types ('typeof (dev->addr_len) *' (aka 'unsigned char *') and 'typeof (sizeof (r->arp_ha.sa_data)) *' (aka 'unsigned long *'))
Date: Thu, 3 Jul 2025 07:04:04 +0200	[thread overview]
Message-ID: <202507030748.cQODcYRb-lkp@intel.com> (raw)

tree:   https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS
head:   382711115afc1197da2c288679079946650ef017
commit: 7ad207616673722d5cf52c18d9464e0d3184ffc9 [1605/1605] arp: Prevent overflow in arp_req_get().
config: x86_64-buildonly-randconfig-2002-20250501 (https://download.01.org/0day-ci/archive/20250703/202507030748.cQODcYRb-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250703/202507030748.cQODcYRb-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507030748.cQODcYRb-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> net/ipv4/arp.c:1106:5: warning: comparison of distinct pointer types ('typeof (dev->addr_len) *' (aka 'unsigned char *') and 'typeof (sizeof (r->arp_ha.sa_data)) *' (aka 'unsigned long *')) [-Wcompare-distinct-pointer-types]
    1106 |                                 min(dev->addr_len, sizeof(r->arp_ha.sa_data)));
         |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:884:19: note: expanded from macro 'min'
     884 | #define min(x, y)       __careful_cmp(x, y, <)
         |                         ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:875:24: note: expanded from macro '__careful_cmp'
     875 |         __builtin_choose_expr(__safe_cmp(x, y), \
         |                               ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:865:4: note: expanded from macro '__safe_cmp'
     865 |                 (__typecheck(x, y) && __no_side_effects(x, y))
         |                  ^~~~~~~~~~~~~~~~~
   include/linux/kernel.h:851:29: note: expanded from macro '__typecheck'
     851 |                 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
         |                            ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   1 warning generated.
   net/ipv4/arp.o: warning: objtool: missing symbol for section .init.text


vim +1106 net/ipv4/arp.c

  1090	
  1091	/*
  1092	 *	Get an ARP cache entry.
  1093	 */
  1094	
  1095	static int arp_req_get(struct arpreq *r, struct net_device *dev)
  1096	{
  1097		__be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
  1098		struct neighbour *neigh;
  1099		int err = -ENXIO;
  1100	
  1101		neigh = neigh_lookup(&arp_tbl, &ip, dev);
  1102		if (neigh) {
  1103			if (!(neigh->nud_state & NUD_NOARP)) {
  1104				read_lock_bh(&neigh->lock);
  1105				memcpy(r->arp_ha.sa_data, neigh->ha,
> 1106					min(dev->addr_len, sizeof(r->arp_ha.sa_data)));
  1107				r->arp_flags = arp_state_to_flags(neigh);
  1108				read_unlock_bh(&neigh->lock);
  1109				r->arp_ha.sa_family = dev->type;
  1110				strlcpy(r->arp_dev, dev->name, sizeof(r->arp_dev));
  1111				err = 0;
  1112			}
  1113			neigh_release(neigh);
  1114		}
  1115		return err;
  1116	}
  1117	

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

                 reply	other threads:[~2025-07-03  5:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202507030748.cQODcYRb-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dongchenchen2@huawei.com \
    --cc=kernel@openeuler.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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.