From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [intel-linux-intel-lts:4.19/android_r 19120/22631] security/security.c:381:5: warning: no previous prototype for 'lsm_file_alloc'
Date: Sat, 10 Apr 2021 15:02:51 +0800 [thread overview]
Message-ID: <202104101544.XYcHUX95-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 24103 bytes --]
tree: https://github.com/intel/linux-intel-lts.git 4.19/android_r
head: 072f407465e8e25a3c2c22590e1ab72ccf335151
commit: b652a52d36a85d1b731921ba08e701d7150ce200 [19120/22631] Merge branch 'aosp/android-4.19-stable' into android_r
config: m68k-randconfig-r036-20210409 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.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/intel/linux-intel-lts/commit/b652a52d36a85d1b731921ba08e701d7150ce200
git remote add intel-linux-intel-lts https://github.com/intel/linux-intel-lts.git
git fetch --no-tags intel-linux-intel-lts 4.19/android_r
git checkout b652a52d36a85d1b731921ba08e701d7150ce200
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from arch/m68k/include/asm/bug.h:32,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:81,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/ktime.h:24,
from include/linux/timer.h:6,
from include/linux/workqueue.h:9,
from include/linux/bpf.h:12,
from security/security.c:15:
include/linux/scatterlist.h: In function 'sg_set_buf':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/asm-generic/bug.h:188:36: note: in definition of macro 'BUG_ON'
188 | #define BUG_ON(condition) do { if (condition) BUG(); } while (0)
| ^~~~~~~~~
include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid'
143 | BUG_ON(!virt_addr_valid(buf));
| ^~~~~~~~~~~~~~~
include/linux/dma-mapping.h: In function 'dma_map_resource':
arch/m68k/include/asm/page_mm.h:169:49: warning: ordered comparison of pointer with null pointer [-Wextra]
169 | #define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
| ^~
include/asm-generic/bug.h:188:36: note: in definition of macro 'BUG_ON'
188 | #define BUG_ON(condition) do { if (condition) BUG(); } while (0)
| ^~~~~~~~~
arch/m68k/include/asm/page_mm.h:170:25: note: in expansion of macro 'virt_addr_valid'
170 | #define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
| ^~~~~~~~~~~~~~~
include/linux/dma-mapping.h:392:9: note: in expansion of macro 'pfn_valid'
392 | BUG_ON(pfn_valid(PHYS_PFN(phys_addr)));
| ^~~~~~~~~
security/security.c: At top level:
>> security/security.c:381:5: warning: no previous prototype for 'lsm_file_alloc' [-Wmissing-prototypes]
381 | int lsm_file_alloc(struct file *file)
| ^~~~~~~~~~~~~~
>> security/security.c:402:5: warning: no previous prototype for 'lsm_task_alloc' [-Wmissing-prototypes]
402 | int lsm_task_alloc(struct task_struct *task)
| ^~~~~~~~~~~~~~
>> security/security.c:482:5: warning: no previous prototype for 'lsm_ipc_alloc' [-Wmissing-prototypes]
482 | int lsm_ipc_alloc(struct kern_ipc_perm *kip)
| ^~~~~~~~~~~~~
>> security/security.c:504:5: warning: no previous prototype for 'lsm_key_alloc' [-Wmissing-prototypes]
504 | int lsm_key_alloc(struct key *key)
| ^~~~~~~~~~~~~
>> security/security.c:526:5: warning: no previous prototype for 'lsm_msg_msg_alloc' [-Wmissing-prototypes]
526 | int lsm_msg_msg_alloc(struct msg_msg *mp)
| ^~~~~~~~~~~~~~~~~
>> security/security.c:548:5: warning: no previous prototype for 'lsm_sock_alloc' [-Wmissing-prototypes]
548 | int lsm_sock_alloc(struct sock *sock, gfp_t priority)
| ^~~~~~~~~~~~~~
>> security/security.c:569:5: warning: no previous prototype for 'lsm_superblock_alloc' [-Wmissing-prototypes]
569 | int lsm_superblock_alloc(struct super_block *sb)
| ^~~~~~~~~~~~~~~~~~~~
security/security.c:220: warning: Function parameter or member 'lsm' not described in 'security_module_enable'
security/security.c:220: warning: Excess function parameter 'module' description in 'security_module_enable'
--
security/integrity/ima/ima_policy.c: In function 'ima_lsm_update_rules':
security/integrity/ima/ima_policy.c:253:6: warning: variable 'result' set but not used [-Wunused-but-set-variable]
253 | int result;
| ^~~~~~
security/integrity/ima/ima_policy.c: In function 'ima_match_rules':
>> security/integrity/ima/ima_policy.c:332:36: warning: passing argument 1 of 'security_filter_rule_match' makes integer from pointer without a cast [-Wint-conversion]
332 | rc = security_filter_rule_match(&osid,
| ^~~~~
| |
| struct secids *
In file included from security/integrity/ima/ima_policy.c:24:
security/integrity/ima/ima.h:313:50: note: expected 'u32' {aka 'unsigned int'} but argument is of type 'struct secids *'
313 | static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
| ~~~~^~~~~
security/integrity/ima/ima_policy.c:341:36: warning: passing argument 1 of 'security_filter_rule_match' makes integer from pointer without a cast [-Wint-conversion]
341 | rc = security_filter_rule_match(secid,
| ^~~~~
| |
| struct secids *
In file included from security/integrity/ima/ima_policy.c:24:
security/integrity/ima/ima.h:313:50: note: expected 'u32' {aka 'unsigned int'} but argument is of type 'struct secids *'
313 | static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
| ~~~~^~~~~
security/integrity/ima/ima_policy.c: In function 'ima_init_policy':
security/integrity/ima/ima_policy.c:526:16: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
526 | for (i = 0; i < ARRAY_SIZE(build_appraise_rules); i++) {
| ^
security/integrity/ima/ima_policy.c: In function 'ima_parse_rule':
security/integrity/ima/ima_policy.c:855:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
855 | entry->uid_op = &uid_gt;
| ~~~~~~~~~~~~~~^~~~~~~~~
security/integrity/ima/ima_policy.c:856:3: note: here
856 | case Opt_uid_lt:
| ^~~~
security/integrity/ima/ima_policy.c:858:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
858 | if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
| ^
security/integrity/ima/ima_policy.c:860:3: note: here
860 | case Opt_uid_eq:
| ^~~~
security/integrity/ima/ima_policy.c:887:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
887 | entry->fowner_op = &uid_gt;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~
security/integrity/ima/ima_policy.c:888:3: note: here
888 | case Opt_fowner_lt:
| ^~~~
security/integrity/ima/ima_policy.c:889:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
889 | if (token == Opt_fowner_lt)
| ^
security/integrity/ima/ima_policy.c:891:3: note: here
891 | case Opt_fowner_eq:
| ^~~~
security/integrity/ima/ima_policy.c:405: warning: Function parameter or member 'flags' not described in 'ima_match_policy'
security/integrity/ima/ima_policy.c:998: warning: Function parameter or member 'rule' not described in 'ima_parse_add_rule'
vim +/lsm_file_alloc +381 security/security.c
d082cff47912b9 Casey Schaufler 2018-05-10 372
d082cff47912b9 Casey Schaufler 2018-05-10 373 /**
d082cff47912b9 Casey Schaufler 2018-05-10 374 * lsm_file_alloc - allocate a composite file blob
d082cff47912b9 Casey Schaufler 2018-05-10 375 * @file: the file that needs a blob
d082cff47912b9 Casey Schaufler 2018-05-10 376 *
d082cff47912b9 Casey Schaufler 2018-05-10 377 * Allocate the file blob for all the modules
d082cff47912b9 Casey Schaufler 2018-05-10 378 *
d082cff47912b9 Casey Schaufler 2018-05-10 379 * Returns 0, or -ENOMEM if memory can't be allocated.
d082cff47912b9 Casey Schaufler 2018-05-10 380 */
d082cff47912b9 Casey Schaufler 2018-05-10 @381 int lsm_file_alloc(struct file *file)
d082cff47912b9 Casey Schaufler 2018-05-10 382 {
d082cff47912b9 Casey Schaufler 2018-05-10 383 if (!lsm_file_cache) {
d082cff47912b9 Casey Schaufler 2018-05-10 384 file->f_security = NULL;
d082cff47912b9 Casey Schaufler 2018-05-10 385 return 0;
d082cff47912b9 Casey Schaufler 2018-05-10 386 }
d082cff47912b9 Casey Schaufler 2018-05-10 387
d082cff47912b9 Casey Schaufler 2018-05-10 388 file->f_security = kmem_cache_zalloc(lsm_file_cache, GFP_KERNEL);
d082cff47912b9 Casey Schaufler 2018-05-10 389 if (file->f_security == NULL)
d082cff47912b9 Casey Schaufler 2018-05-10 390 return -ENOMEM;
d082cff47912b9 Casey Schaufler 2018-05-10 391 return 0;
7880b02f0906b7 Casey Schaufler 2018-08-27 392 }
7880b02f0906b7 Casey Schaufler 2018-08-27 393
7cb75cc654c717 Casey Schaufler 2018-05-10 394 /**
7cb75cc654c717 Casey Schaufler 2018-05-10 395 * lsm_task_alloc - allocate a composite task blob
7cb75cc654c717 Casey Schaufler 2018-05-10 396 * @task: the task that needs a blob
7cb75cc654c717 Casey Schaufler 2018-05-10 397 *
7cb75cc654c717 Casey Schaufler 2018-05-10 398 * Allocate the task blob for all the modules
7cb75cc654c717 Casey Schaufler 2018-05-10 399 *
7cb75cc654c717 Casey Schaufler 2018-05-10 400 * Returns 0, or -ENOMEM if memory can't be allocated.
7cb75cc654c717 Casey Schaufler 2018-05-10 401 */
7cb75cc654c717 Casey Schaufler 2018-05-10 @402 int lsm_task_alloc(struct task_struct *task)
7cb75cc654c717 Casey Schaufler 2018-05-10 403 {
7cb75cc654c717 Casey Schaufler 2018-05-10 404 if (blob_sizes.lbs_task == 0) {
7cb75cc654c717 Casey Schaufler 2018-05-10 405 task->security = NULL;
7cb75cc654c717 Casey Schaufler 2018-05-10 406 return 0;
7cb75cc654c717 Casey Schaufler 2018-05-10 407 }
7cb75cc654c717 Casey Schaufler 2018-05-10 408
7cb75cc654c717 Casey Schaufler 2018-05-10 409 task->security = kzalloc(blob_sizes.lbs_task, GFP_KERNEL);
7cb75cc654c717 Casey Schaufler 2018-05-10 410 if (task->security == NULL)
7cb75cc654c717 Casey Schaufler 2018-05-10 411 return -ENOMEM;
7cb75cc654c717 Casey Schaufler 2018-05-10 412 return 0;
7cb75cc654c717 Casey Schaufler 2018-05-10 413 }
7cb75cc654c717 Casey Schaufler 2018-05-10 414
7cb75cc654c717 Casey Schaufler 2018-05-10 415 /**
7cb75cc654c717 Casey Schaufler 2018-05-10 416 * lsm_early_task - during initialization allocate a composite task blob
7cb75cc654c717 Casey Schaufler 2018-05-10 417 * @task: the task that needs a blob
7cb75cc654c717 Casey Schaufler 2018-05-10 418 *
7cb75cc654c717 Casey Schaufler 2018-05-10 419 * Allocate the task blob for all the modules if it's not already there
7cb75cc654c717 Casey Schaufler 2018-05-10 420 */
7cb75cc654c717 Casey Schaufler 2018-05-10 421 void lsm_early_task(struct task_struct *task)
7cb75cc654c717 Casey Schaufler 2018-05-10 422 {
7cb75cc654c717 Casey Schaufler 2018-05-10 423 int rc;
7cb75cc654c717 Casey Schaufler 2018-05-10 424
7cb75cc654c717 Casey Schaufler 2018-05-10 425 if (task == NULL)
7cb75cc654c717 Casey Schaufler 2018-05-10 426 panic("%s: task cred.\n", __func__);
7cb75cc654c717 Casey Schaufler 2018-05-10 427 if (task->security != NULL)
7cb75cc654c717 Casey Schaufler 2018-05-10 428 return;
7cb75cc654c717 Casey Schaufler 2018-05-10 429 rc = lsm_task_alloc(task);
7cb75cc654c717 Casey Schaufler 2018-05-10 430 if (rc)
7cb75cc654c717 Casey Schaufler 2018-05-10 431 panic("%s: Early task alloc failed.\n", __func__);
7cb75cc654c717 Casey Schaufler 2018-05-10 432 }
7cb75cc654c717 Casey Schaufler 2018-05-10 433
aa6496634cff6a Casey Schaufler 2018-06-20 434 /**
aa6496634cff6a Casey Schaufler 2018-06-20 435 * lsm_inode_alloc - allocate a composite inode blob
aa6496634cff6a Casey Schaufler 2018-06-20 436 * @inode: the inode that needs a blob
aa6496634cff6a Casey Schaufler 2018-06-20 437 *
aa6496634cff6a Casey Schaufler 2018-06-20 438 * Allocate the inode blob for all the modules
aa6496634cff6a Casey Schaufler 2018-06-20 439 *
aa6496634cff6a Casey Schaufler 2018-06-20 440 * Returns 0, or -ENOMEM if memory can't be allocated.
aa6496634cff6a Casey Schaufler 2018-06-20 441 */
aa6496634cff6a Casey Schaufler 2018-06-20 442 int lsm_inode_alloc(struct inode *inode)
aa6496634cff6a Casey Schaufler 2018-06-20 443 {
aa6496634cff6a Casey Schaufler 2018-06-20 444 if (!lsm_inode_cache) {
aa6496634cff6a Casey Schaufler 2018-06-20 445 inode->i_security = NULL;
aa6496634cff6a Casey Schaufler 2018-06-20 446 return 0;
aa6496634cff6a Casey Schaufler 2018-06-20 447 }
aa6496634cff6a Casey Schaufler 2018-06-20 448
aa6496634cff6a Casey Schaufler 2018-06-20 449 inode->i_security = kmem_cache_zalloc(lsm_inode_cache, GFP_NOFS);
aa6496634cff6a Casey Schaufler 2018-06-20 450 if (inode->i_security == NULL)
aa6496634cff6a Casey Schaufler 2018-06-20 451 return -ENOMEM;
aa6496634cff6a Casey Schaufler 2018-06-20 452 return 0;
aa6496634cff6a Casey Schaufler 2018-06-20 453 }
aa6496634cff6a Casey Schaufler 2018-06-20 454
aa6496634cff6a Casey Schaufler 2018-06-20 455 /**
aa6496634cff6a Casey Schaufler 2018-06-20 456 * lsm_early_inode - during initialization allocate a composite inode blob
aa6496634cff6a Casey Schaufler 2018-06-20 457 * @inode: the inode that needs a blob
aa6496634cff6a Casey Schaufler 2018-06-20 458 *
aa6496634cff6a Casey Schaufler 2018-06-20 459 * Allocate the inode blob for all the modules if it's not already there
aa6496634cff6a Casey Schaufler 2018-06-20 460 */
aa6496634cff6a Casey Schaufler 2018-06-20 461 void lsm_early_inode(struct inode *inode)
aa6496634cff6a Casey Schaufler 2018-06-20 462 {
aa6496634cff6a Casey Schaufler 2018-06-20 463 int rc;
aa6496634cff6a Casey Schaufler 2018-06-20 464
aa6496634cff6a Casey Schaufler 2018-06-20 465 if (inode == NULL)
aa6496634cff6a Casey Schaufler 2018-06-20 466 panic("%s: NULL inode.\n", __func__);
aa6496634cff6a Casey Schaufler 2018-06-20 467 if (inode->i_security != NULL)
aa6496634cff6a Casey Schaufler 2018-06-20 468 return;
aa6496634cff6a Casey Schaufler 2018-06-20 469 rc = lsm_inode_alloc(inode);
aa6496634cff6a Casey Schaufler 2018-06-20 470 if (rc)
aa6496634cff6a Casey Schaufler 2018-06-20 471 panic("%s: Early inode alloc failed.\n", __func__);
aa6496634cff6a Casey Schaufler 2018-06-20 472 }
aa6496634cff6a Casey Schaufler 2018-06-20 473
e92c67fcf33bb7 Casey Schaufler 2018-06-21 474 /**
e92c67fcf33bb7 Casey Schaufler 2018-06-21 475 * lsm_ipc_alloc - allocate a composite ipc blob
e92c67fcf33bb7 Casey Schaufler 2018-06-21 476 * @kip: the ipc that needs a blob
e92c67fcf33bb7 Casey Schaufler 2018-06-21 477 *
e92c67fcf33bb7 Casey Schaufler 2018-06-21 478 * Allocate the ipc blob for all the modules
e92c67fcf33bb7 Casey Schaufler 2018-06-21 479 *
e92c67fcf33bb7 Casey Schaufler 2018-06-21 480 * Returns 0, or -ENOMEM if memory can't be allocated.
e92c67fcf33bb7 Casey Schaufler 2018-06-21 481 */
e92c67fcf33bb7 Casey Schaufler 2018-06-21 @482 int lsm_ipc_alloc(struct kern_ipc_perm *kip)
e92c67fcf33bb7 Casey Schaufler 2018-06-21 483 {
e92c67fcf33bb7 Casey Schaufler 2018-06-21 484 if (blob_sizes.lbs_ipc == 0) {
e92c67fcf33bb7 Casey Schaufler 2018-06-21 485 kip->security = NULL;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 486 return 0;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 487 }
e92c67fcf33bb7 Casey Schaufler 2018-06-21 488
e92c67fcf33bb7 Casey Schaufler 2018-06-21 489 kip->security = kzalloc(blob_sizes.lbs_ipc, GFP_KERNEL);
e92c67fcf33bb7 Casey Schaufler 2018-06-21 490 if (kip->security == NULL)
e92c67fcf33bb7 Casey Schaufler 2018-06-21 491 return -ENOMEM;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 492 return 0;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 493 }
e92c67fcf33bb7 Casey Schaufler 2018-06-21 494
1d4be734af45c0 Casey Schaufler 2018-05-10 495 #ifdef CONFIG_KEYS
1d4be734af45c0 Casey Schaufler 2018-05-10 496 /**
1d4be734af45c0 Casey Schaufler 2018-05-10 497 * lsm_key_alloc - allocate a composite key blob
1d4be734af45c0 Casey Schaufler 2018-05-10 498 * @key: the key that needs a blob
1d4be734af45c0 Casey Schaufler 2018-05-10 499 *
1d4be734af45c0 Casey Schaufler 2018-05-10 500 * Allocate the key blob for all the modules
1d4be734af45c0 Casey Schaufler 2018-05-10 501 *
1d4be734af45c0 Casey Schaufler 2018-05-10 502 * Returns 0, or -ENOMEM if memory can't be allocated.
1d4be734af45c0 Casey Schaufler 2018-05-10 503 */
1d4be734af45c0 Casey Schaufler 2018-05-10 @504 int lsm_key_alloc(struct key *key)
1d4be734af45c0 Casey Schaufler 2018-05-10 505 {
1d4be734af45c0 Casey Schaufler 2018-05-10 506 if (blob_sizes.lbs_key == 0) {
1d4be734af45c0 Casey Schaufler 2018-05-10 507 key->security = NULL;
1d4be734af45c0 Casey Schaufler 2018-05-10 508 return 0;
1d4be734af45c0 Casey Schaufler 2018-05-10 509 }
1d4be734af45c0 Casey Schaufler 2018-05-10 510
1d4be734af45c0 Casey Schaufler 2018-05-10 511 key->security = kzalloc(blob_sizes.lbs_key, GFP_KERNEL);
1d4be734af45c0 Casey Schaufler 2018-05-10 512 if (key->security == NULL)
1d4be734af45c0 Casey Schaufler 2018-05-10 513 return -ENOMEM;
1d4be734af45c0 Casey Schaufler 2018-05-10 514 return 0;
1d4be734af45c0 Casey Schaufler 2018-05-10 515 }
1d4be734af45c0 Casey Schaufler 2018-05-10 516 #endif /* CONFIG_KEYS */
1d4be734af45c0 Casey Schaufler 2018-05-10 517
e92c67fcf33bb7 Casey Schaufler 2018-06-21 518 /**
e92c67fcf33bb7 Casey Schaufler 2018-06-21 519 * lsm_msg_msg_alloc - allocate a composite msg_msg blob
e92c67fcf33bb7 Casey Schaufler 2018-06-21 520 * @mp: the msg_msg that needs a blob
e92c67fcf33bb7 Casey Schaufler 2018-06-21 521 *
e92c67fcf33bb7 Casey Schaufler 2018-06-21 522 * Allocate the ipc blob for all the modules
e92c67fcf33bb7 Casey Schaufler 2018-06-21 523 *
e92c67fcf33bb7 Casey Schaufler 2018-06-21 524 * Returns 0, or -ENOMEM if memory can't be allocated.
e92c67fcf33bb7 Casey Schaufler 2018-06-21 525 */
e92c67fcf33bb7 Casey Schaufler 2018-06-21 @526 int lsm_msg_msg_alloc(struct msg_msg *mp)
e92c67fcf33bb7 Casey Schaufler 2018-06-21 527 {
e92c67fcf33bb7 Casey Schaufler 2018-06-21 528 if (blob_sizes.lbs_msg_msg == 0) {
e92c67fcf33bb7 Casey Schaufler 2018-06-21 529 mp->security = NULL;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 530 return 0;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 531 }
e92c67fcf33bb7 Casey Schaufler 2018-06-21 532
e92c67fcf33bb7 Casey Schaufler 2018-06-21 533 mp->security = kzalloc(blob_sizes.lbs_msg_msg, GFP_KERNEL);
e92c67fcf33bb7 Casey Schaufler 2018-06-21 534 if (mp->security == NULL)
e92c67fcf33bb7 Casey Schaufler 2018-06-21 535 return -ENOMEM;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 536 return 0;
e92c67fcf33bb7 Casey Schaufler 2018-06-21 537 }
e92c67fcf33bb7 Casey Schaufler 2018-06-21 538
36f477475f6efc Casey Schaufler 2018-07-12 539 /**
36f477475f6efc Casey Schaufler 2018-07-12 540 * lsm_sock_alloc - allocate a composite sock blob
36f477475f6efc Casey Schaufler 2018-07-12 541 * @sock: the sock that needs a blob
36f477475f6efc Casey Schaufler 2018-07-12 542 * @priority: allocation mode
36f477475f6efc Casey Schaufler 2018-07-12 543 *
36f477475f6efc Casey Schaufler 2018-07-12 544 * Allocate the sock blob for all the modules
36f477475f6efc Casey Schaufler 2018-07-12 545 *
36f477475f6efc Casey Schaufler 2018-07-12 546 * Returns 0, or -ENOMEM if memory can't be allocated.
36f477475f6efc Casey Schaufler 2018-07-12 547 */
36f477475f6efc Casey Schaufler 2018-07-12 @548 int lsm_sock_alloc(struct sock *sock, gfp_t priority)
36f477475f6efc Casey Schaufler 2018-07-12 549 {
36f477475f6efc Casey Schaufler 2018-07-12 550 if (blob_sizes.lbs_sock == 0) {
36f477475f6efc Casey Schaufler 2018-07-12 551 sock->sk_security = NULL;
36f477475f6efc Casey Schaufler 2018-07-12 552 return 0;
36f477475f6efc Casey Schaufler 2018-07-12 553 }
36f477475f6efc Casey Schaufler 2018-07-12 554
36f477475f6efc Casey Schaufler 2018-07-12 555 sock->sk_security = kzalloc(blob_sizes.lbs_sock, priority);
36f477475f6efc Casey Schaufler 2018-07-12 556 if (sock->sk_security == NULL)
36f477475f6efc Casey Schaufler 2018-07-12 557 return -ENOMEM;
36f477475f6efc Casey Schaufler 2018-07-12 558 return 0;
36f477475f6efc Casey Schaufler 2018-07-12 559 }
36f477475f6efc Casey Schaufler 2018-07-12 560
01de591a11f331 Casey Schaufler 2018-05-10 561 /**
01de591a11f331 Casey Schaufler 2018-05-10 562 * lsm_superblock_alloc - allocate a composite superblock blob
01de591a11f331 Casey Schaufler 2018-05-10 563 * @sb: the superblock that needs a blob
01de591a11f331 Casey Schaufler 2018-05-10 564 *
01de591a11f331 Casey Schaufler 2018-05-10 565 * Allocate the superblock blob for all the modules
01de591a11f331 Casey Schaufler 2018-05-10 566 *
01de591a11f331 Casey Schaufler 2018-05-10 567 * Returns 0, or -ENOMEM if memory can't be allocated.
01de591a11f331 Casey Schaufler 2018-05-10 568 */
01de591a11f331 Casey Schaufler 2018-05-10 @569 int lsm_superblock_alloc(struct super_block *sb)
01de591a11f331 Casey Schaufler 2018-05-10 570 {
01de591a11f331 Casey Schaufler 2018-05-10 571 if (blob_sizes.lbs_superblock == 0) {
01de591a11f331 Casey Schaufler 2018-05-10 572 sb->s_security = NULL;
01de591a11f331 Casey Schaufler 2018-05-10 573 return 0;
01de591a11f331 Casey Schaufler 2018-05-10 574 }
01de591a11f331 Casey Schaufler 2018-05-10 575
01de591a11f331 Casey Schaufler 2018-05-10 576 sb->s_security = kzalloc(blob_sizes.lbs_superblock, GFP_KERNEL);
01de591a11f331 Casey Schaufler 2018-05-10 577 if (sb->s_security == NULL)
01de591a11f331 Casey Schaufler 2018-05-10 578 return -ENOMEM;
01de591a11f331 Casey Schaufler 2018-05-10 579 return 0;
01de591a11f331 Casey Schaufler 2018-05-10 580 }
01de591a11f331 Casey Schaufler 2018-05-10 581
:::::: The code at line 381 was first introduced by commit
:::::: d082cff47912b94848d4e470a40449bf84b7536f LSM: Infrastructure management of the file security blob
:::::: TO: Casey Schaufler <casey@schaufler-ca.com>
:::::: CC: Pan, Kris <kris.pan@intel.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 20267 bytes --]
reply other threads:[~2021-04-10 7:02 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=202104101544.XYcHUX95-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.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 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.