lkml.org 
[lkml]   [2020]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectsecurity/smack/smack_lsm.c:2498:27: sparse: sparse: incorrect type in assignment (different base types)
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5631c5e0eb9035d92ceb20fcd9cdb7779a3f5cc7
commit: 00720f0e7f288d29681d265c23b22bb0f0f4e5b4 smack: avoid unused 'sip' variable warning
date: 3 months ago
config: s390-randconfig-s032-20200808 (attached as .config)
compiler: s390-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-118-ge1578773-dirty
git checkout 00720f0e7f288d29681d265c23b22bb0f0f4e5b4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=s390

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


sparse warnings: (new ones prefixed by >>)

security/smack/smack_lsm.c:1780:61: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct cred const *cred @@ got struct cred const [noderef] <asn:4> *cred @@
security/smack/smack_lsm.c:1780:61: sparse: expected struct cred const *cred
security/smack/smack_lsm.c:1780:61: sparse: got struct cred const [noderef] <asn:4> *cred
>> security/smack/smack_lsm.c:2498:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] dport @@ got unsigned short [usertype] @@
security/smack/smack_lsm.c:2498:27: sparse: expected restricted __be16 [usertype] dport
>> security/smack/smack_lsm.c:2498:27: sparse: got unsigned short [usertype]
security/smack/smack_lsm.c:4751:30: sparse: sparse: cast removes address space '<asn:4>' of expression

vim +2498 security/smack/smack_lsm.c

e114e473771c84 Casey Schaufler 2008-02-04 2475
21abb1ec414c75 Casey Schaufler 2015-07-22 2476 /**
21abb1ec414c75 Casey Schaufler 2015-07-22 2477 * smk_ipv6_check - check Smack access
21abb1ec414c75 Casey Schaufler 2015-07-22 2478 * @subject: subject Smack label
21abb1ec414c75 Casey Schaufler 2015-07-22 2479 * @object: object Smack label
21abb1ec414c75 Casey Schaufler 2015-07-22 2480 * @address: address
21abb1ec414c75 Casey Schaufler 2015-07-22 2481 * @act: the action being taken
21abb1ec414c75 Casey Schaufler 2015-07-22 2482 *
21abb1ec414c75 Casey Schaufler 2015-07-22 2483 * Check an IPv6 access
21abb1ec414c75 Casey Schaufler 2015-07-22 2484 */
21abb1ec414c75 Casey Schaufler 2015-07-22 2485 static int smk_ipv6_check(struct smack_known *subject,
21abb1ec414c75 Casey Schaufler 2015-07-22 2486 struct smack_known *object,
21abb1ec414c75 Casey Schaufler 2015-07-22 2487 struct sockaddr_in6 *address, int act)
21abb1ec414c75 Casey Schaufler 2015-07-22 2488 {
21abb1ec414c75 Casey Schaufler 2015-07-22 2489 #ifdef CONFIG_AUDIT
21abb1ec414c75 Casey Schaufler 2015-07-22 2490 struct lsm_network_audit net;
21abb1ec414c75 Casey Schaufler 2015-07-22 2491 #endif
21abb1ec414c75 Casey Schaufler 2015-07-22 2492 struct smk_audit_info ad;
21abb1ec414c75 Casey Schaufler 2015-07-22 2493 int rc;
21abb1ec414c75 Casey Schaufler 2015-07-22 2494
21abb1ec414c75 Casey Schaufler 2015-07-22 2495 #ifdef CONFIG_AUDIT
21abb1ec414c75 Casey Schaufler 2015-07-22 2496 smk_ad_init_net(&ad, __func__, LSM_AUDIT_DATA_NET, &net);
21abb1ec414c75 Casey Schaufler 2015-07-22 2497 ad.a.u.net->family = PF_INET6;
21abb1ec414c75 Casey Schaufler 2015-07-22 @2498 ad.a.u.net->dport = ntohs(address->sin6_port);
21abb1ec414c75 Casey Schaufler 2015-07-22 2499 if (act == SMK_RECEIVING)
21abb1ec414c75 Casey Schaufler 2015-07-22 2500 ad.a.u.net->v6info.saddr = address->sin6_addr;
21abb1ec414c75 Casey Schaufler 2015-07-22 2501 else
21abb1ec414c75 Casey Schaufler 2015-07-22 2502 ad.a.u.net->v6info.daddr = address->sin6_addr;
21abb1ec414c75 Casey Schaufler 2015-07-22 2503 #endif
21abb1ec414c75 Casey Schaufler 2015-07-22 2504 rc = smk_access(subject, object, MAY_WRITE, &ad);
21abb1ec414c75 Casey Schaufler 2015-07-22 2505 rc = smk_bu_note("IPv6 check", subject, object, MAY_WRITE, rc);
21abb1ec414c75 Casey Schaufler 2015-07-22 2506 return rc;
21abb1ec414c75 Casey Schaufler 2015-07-22 2507 }
21abb1ec414c75 Casey Schaufler 2015-07-22 2508

:::::: The code at line 2498 was first introduced by commit
:::::: 21abb1ec414c75abe32c3854848ff30e2b4a6113 Smack: IPv6 host labeling

:::::: TO: Casey Schaufler <casey@schaufler-ca.com>
:::::: CC: Casey Schaufler <casey@schaufler-ca.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2020-08-08 00:23    [W:0.051 / U:2.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site