tree:
https://android.googlesource.com/kernel/common android-5.4
head: 20810a2469745210a7b2b8e0f9f3b60a28305f43
commit: 20810a2469745210a7b2b8e0f9f3b60a28305f43 [1/1] UPSTREAM: selinux: sidtab reverse
lookup hash table
config: x86_64-randconfig-a013-20210816 (attached as .config)
compiler: clang version 14.0.0 (
https://github.com/llvm/llvm-project
2c6448cdc2f68f8c28fd0bd9404182b81306e6e6)
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
git remote add android-common
https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-5.4
git checkout 20810a2469745210a7b2b8e0f9f3b60a28305f43
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> security/selinux/ss/services.c:2316:17: warning: variable
'sidtab' set but not used [-Wunused-but-set-variable]
struct
sidtab *sidtab;
^
security/selinux/ss/services.c:2405:17: warning: variable 'sidtab' set but not
used [-Wunused-but-set-variable]
struct sidtab *sidtab;
^
security/selinux/ss/services.c:2450:17: warning: variable 'sidtab' set but not
used [-Wunused-but-set-variable]
struct sidtab *sidtab;
^
security/selinux/ss/services.c:2801:17: warning: variable 'sidtab' set but not
used [-Wunused-but-set-variable]
struct sidtab *sidtab;
^
4 warnings generated.
vim +/sidtab +2316 security/selinux/ss/services.c
cee74f47a6baba Eric Paris 2010-10-13 2305
^1da177e4c3f41 Linus Torvalds 2005-04-16 2306 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 2307 * security_port_sid - Obtain the SID
for a port.
^1da177e4c3f41 Linus Torvalds 2005-04-16 2308 * @protocol: protocol number
^1da177e4c3f41 Linus Torvalds 2005-04-16 2309 * @port: port number
^1da177e4c3f41 Linus Torvalds 2005-04-16 2310 * @out_sid: security identifier
^1da177e4c3f41 Linus Torvalds 2005-04-16 2311 */
aa8e712cee93d5 Stephen Smalley 2018-03-01 2312 int security_port_sid(struct
selinux_state *state,
aa8e712cee93d5 Stephen Smalley 2018-03-01 2313 u8 protocol, u16 port, u32
*out_sid)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2314 {
aa8e712cee93d5 Stephen Smalley 2018-03-01 2315 struct policydb *policydb;
aa8e712cee93d5 Stephen Smalley 2018-03-01 @2316 struct sidtab *sidtab;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2317 struct ocontext *c;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2318 int rc = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2319
aa8e712cee93d5 Stephen Smalley 2018-03-01 2320
read_lock(&state->ss->policy_rwlock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2321
aa8e712cee93d5 Stephen Smalley 2018-03-01 2322 policydb =
&state->ss->policydb;
24ed7fdae669fe Ondrej Mosnacek 2018-11-30 2323 sidtab = state->ss->sidtab;
aa8e712cee93d5 Stephen Smalley 2018-03-01 2324
aa8e712cee93d5 Stephen Smalley 2018-03-01 2325 c =
policydb->ocontexts[OCON_PORT];
^1da177e4c3f41 Linus Torvalds 2005-04-16 2326 while (c) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2327 if (c->u.port.protocol == protocol
&&
^1da177e4c3f41 Linus Torvalds 2005-04-16 2328 c->u.port.low_port <= port
&&
^1da177e4c3f41 Linus Torvalds 2005-04-16 2329 c->u.port.high_port >=
port)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2330 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2331 c = c->next;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2332 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2333
^1da177e4c3f41 Linus Torvalds 2005-04-16 2334 if (c) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2335 if (!c->sid[0]) {
20810a24697452 Jeff Vander Stoep 2019-11-22 2336 rc = context_struct_to_sid(state,
&c->context[0],
^1da177e4c3f41 Linus Torvalds 2005-04-16 2337 &c->sid[0]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2338 if (rc)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2339 goto out;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2340 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2341 *out_sid = c->sid[0];
^1da177e4c3f41 Linus Torvalds 2005-04-16 2342 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2343 *out_sid = SECINITSID_PORT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2344 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2345
^1da177e4c3f41 Linus Torvalds 2005-04-16 2346 out:
aa8e712cee93d5 Stephen Smalley 2018-03-01 2347
read_unlock(&state->ss->policy_rwlock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2348 return rc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2349 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2350
:::::: The code at line 2316 was first introduced by commit
:::::: aa8e712cee93d520e96a2ca8e3a20f807c937e3f selinux: wrap global selinux state
:::::: TO: Stephen Smalley <sds(a)tycho.nsa.gov>
:::::: CC: Paul Moore <paul(a)paul-moore.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org