mm/huge_memory.c:546 thpsize_create() warn: Calling kobject_put|get with state->initialized unset from line: 533
PATCH 9386/12908 mm/huge_memory.c:546 thpsize_create() warn: Calling kobject_put|get with state->initialized unset from line: 533
Hey Harshit,
We get this warning when the DB isn't enabled. I just pushed a fix for it.
regards,
dan carpenter
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: bffdfd2e7e63175ae261131a620f809d946cf9a7 commit: 3485b88390b0af9e05dc2c3f57e9936f41e159a0 [9386/12908] mm: thp: introduce multi-size THP sysfs interface config: i386-randconfig-141-20240106 (https://download.01.org/0day-ci/archive/20240108/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:mm/huge_memory.c:546 thpsize_create() warn: Calling kobject_put|get with state->initialized unset from line: 533
vim +546 mm/huge_memory.c
3485b88390b0af Ryan Roberts 2023-12-07 527 static struct thpsize *thpsize_create(int order, struct kobject *parent)
3485b88390b0af Ryan Roberts 2023-12-07 528 {
3485b88390b0af Ryan Roberts 2023-12-07 529 unsigned long size = (PAGE_SIZE << order) / SZ_1K;
3485b88390b0af Ryan Roberts 2023-12-07 530 struct thpsize *thpsize;
3485b88390b0af Ryan Roberts 2023-12-07 531 int ret;
3485b88390b0af Ryan Roberts 2023-12-07 532
3485b88390b0af Ryan Roberts 2023-12-07 533 thpsize = kzalloc(sizeof(*thpsize), GFP_KERNEL);
3485b88390b0af Ryan Roberts 2023-12-07 534 if (!thpsize)
3485b88390b0af Ryan Roberts 2023-12-07 535 return ERR_PTR(-ENOMEM);
3485b88390b0af Ryan Roberts 2023-12-07 536
3485b88390b0af Ryan Roberts 2023-12-07 537 ret = kobject_init_and_add(&thpsize->kobj, &thpsize_ktype, parent,
3485b88390b0af Ryan Roberts 2023-12-07 538 "hugepages-%lukB", size);
3485b88390b0af Ryan Roberts 2023-12-07 539 if (ret) {
3485b88390b0af Ryan Roberts 2023-12-07 540 kfree(thpsize);
3485b88390b0af Ryan Roberts 2023-12-07 541 return ERR_PTR(ret);
3485b88390b0af Ryan Roberts 2023-12-07 542 }
3485b88390b0af Ryan Roberts 2023-12-07 543
3485b88390b0af Ryan Roberts 2023-12-07 544 ret = sysfs_create_group(&thpsize->kobj, &thpsize_attr_group);
3485b88390b0af Ryan Roberts 2023-12-07 545 if (ret) {
3485b88390b0af Ryan Roberts 2023-12-07 @546 kobject_put(&thpsize->kobj);
3485b88390b0af Ryan Roberts 2023-12-07 547 return ERR_PTR(ret);
3485b88390b0af Ryan Roberts 2023-12-07 548 }
3485b88390b0af Ryan Roberts 2023-12-07 549
3485b88390b0af Ryan Roberts 2023-12-07 550 thpsize->order = order;
3485b88390b0af Ryan Roberts 2023-12-07 551 return thpsize;
3485b88390b0af Ryan Roberts 2023-12-07 552 }Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Dan,
Quoted 4 lines · Dan Carpenter
Hey Harshit,
We get this warning when the DB isn't enabled. I just pushed a fix for it.
Thanks for fixing it.
Harshit
Quoted 4 lines
regards,
dan carpenter