* linux-next: build warning after merge of the cgroup tree
@ 2023-07-11 1:15 Stephen Rothwell
2023-07-11 1:22 ` Tejun Heo
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2023-07-11 1:15 UTC (permalink / raw)
To: Tejun Heo; +Cc: Miaohe Lin, Linux Kernel Mailing List, Linux Next Mailing List
[-- Attachment #1: Type: text/plain, Size: 497 bytes --]
Hi all,
After merging the cgroup tree, today's linux-next build (arm
multi_v7_defconfig) produced this warning:
kernel/cgroup/cgroup.c:503:36: warning: 'cgroup_tryget_css' defined but not used [-Wunused-function]
503 | static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
| ^~~~~~~~~~~~~~~~~
Introduced by commit
1299eb2b0ad5 ("cgroup: minor cleanup for cgroup_extra_stat_show()")
--
Cheers,
Stephen Rothwell
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: build warning after merge of the cgroup tree
2023-07-11 1:15 linux-next: build warning after merge of the cgroup tree Stephen Rothwell
@ 2023-07-11 1:22 ` Tejun Heo
2023-07-11 2:06 ` Miaohe Lin
0 siblings, 1 reply; 9+ messages in thread
From: Tejun Heo @ 2023-07-11 1:22 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Miaohe Lin, Linux Kernel Mailing List, Linux Next Mailing List
On Tue, Jul 11, 2023 at 11:15:09AM +1000, Stephen Rothwell wrote:
> Hi all,
>
> After merging the cgroup tree, today's linux-next build (arm
> multi_v7_defconfig) produced this warning:
>
> kernel/cgroup/cgroup.c:503:36: warning: 'cgroup_tryget_css' defined but not used [-Wunused-function]
> 503 | static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
> | ^~~~~~~~~~~~~~~~~
>
> Introduced by commit
>
> 1299eb2b0ad5 ("cgroup: minor cleanup for cgroup_extra_stat_show()")
Miaohe, can you send a patch to either add __maybe_unused to
cgroup_tryget_css() or also put it inside CONFIG_CGROUP_SCHED?
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: build warning after merge of the cgroup tree
2023-07-11 1:22 ` Tejun Heo
@ 2023-07-11 2:06 ` Miaohe Lin
0 siblings, 0 replies; 9+ messages in thread
From: Miaohe Lin @ 2023-07-11 2:06 UTC (permalink / raw)
To: Tejun Heo, Stephen Rothwell
Cc: Linux Kernel Mailing List, Linux Next Mailing List
On 2023/7/11 9:22, Tejun Heo wrote:
> On Tue, Jul 11, 2023 at 11:15:09AM +1000, Stephen Rothwell wrote:
>> Hi all,
>>
>> After merging the cgroup tree, today's linux-next build (arm
>> multi_v7_defconfig) produced this warning:
>>
>> kernel/cgroup/cgroup.c:503:36: warning: 'cgroup_tryget_css' defined but not used [-Wunused-function]
>> 503 | static struct cgroup_subsys_state *cgroup_tryget_css(struct cgroup *cgrp,
>> | ^~~~~~~~~~~~~~~~~
>>
>> Introduced by commit
>>
>> 1299eb2b0ad5 ("cgroup: minor cleanup for cgroup_extra_stat_show()")
>
> Miaohe, can you send a patch to either add __maybe_unused to
> cgroup_tryget_css() or also put it inside CONFIG_CGROUP_SCHED?
Will do. Sorry for my mistake.
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* linux-next: build warning after merge of the cgroup tree
@ 2017-12-13 3:56 Stephen Rothwell
2017-12-15 9:58 ` Arnd Bergmann
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2017-12-13 3:56 UTC (permalink / raw)
To: Tejun Heo; +Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Ma Shimiao
Hi Tejun,
After merging the cgroup tree, today's linux-next build (arm
multi_v7_defconfig) produced this warning:
kernel/cgroup/cgroup.c: In function 'init_cgroup_root':
kernel/cgroup/cgroup.c:1867:3: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
strscpy(root->release_agent_path, opts->release_agent, PATH_MAX);
^
kernel/cgroup/cgroup.c:1869:3: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
strscpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN);
^
kernel/cgroup/cgroup.c: In function 'cgroup_file_name':
kernel/cgroup/cgroup.c:1400:3: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
^
Introduced by commit
e7fd37ba1217 ("cgroup: avoid copying strings longer than the buffers")
--
Cheers,
Stephen Rothwell
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: build warning after merge of the cgroup tree
2017-12-13 3:56 Stephen Rothwell
@ 2017-12-15 9:58 ` Arnd Bergmann
2017-12-15 13:10 ` Tejun Heo
0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2017-12-15 9:58 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Tejun Heo, Linux-Next Mailing List, Linux Kernel Mailing List,
Ma Shimiao
On Wed, Dec 13, 2017 at 4:56 AM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> Hi Tejun,
>
> After merging the cgroup tree, today's linux-next build (arm
> multi_v7_defconfig) produced this warning:
>
> kernel/cgroup/cgroup.c: In function 'init_cgroup_root':
> kernel/cgroup/cgroup.c:1867:3: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
> strscpy(root->release_agent_path, opts->release_agent, PATH_MAX);
> ^
> kernel/cgroup/cgroup.c:1869:3: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
> strscpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN);
> ^
> kernel/cgroup/cgroup.c: In function 'cgroup_file_name':
> kernel/cgroup/cgroup.c:1400:3: warning: ignoring return value of 'strscpy', declared with attribute warn_unused_result [-Wunused-result]
> strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
> ^
>
> Introduced by commit
>
> e7fd37ba1217 ("cgroup: avoid copying strings longer than the buffers")
As long as cft->name is guaranteed to be NUL-terminated, using strlcpy() would
work just as well and avoid that warning, so the change below could be folded
into that commit.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index dc442a5d88b9..3cced1259cd3 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1397,7 +1397,7 @@ static char *cgroup_file_name(struct cgroup
*cgrp, const struct cftype *cft,
cgroup_on_dfl(cgrp) ? ss->name : ss->legacy_name,
cft->name);
else
- strscpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
+ strlcpy(buf, cft->name, CGROUP_FILE_NAME_MAX);
return buf;
}
@@ -1874,9 +1874,9 @@ void init_cgroup_root(struct cgroup_root *root,
struct cgroup_sb_opts *opts)
root->flags = opts->flags;
if (opts->release_agent)
- strscpy(root->release_agent_path, opts->release_agent,
PATH_MAX);
+ strlcpy(root->release_agent_path, opts->release_agent,
PATH_MAX);
if (opts->name)
- strscpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN);
+ strlcpy(root->name, opts->name, MAX_CGROUP_ROOT_NAMELEN);
if (opts->cpuset_clone_children)
set_bit(CGRP_CPUSET_CLONE_CHILDREN, &root->cgrp.flags);
}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: linux-next: build warning after merge of the cgroup tree
2017-12-15 9:58 ` Arnd Bergmann
@ 2017-12-15 13:10 ` Tejun Heo
0 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2017-12-15 13:10 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Stephen Rothwell, Linux-Next Mailing List,
Linux Kernel Mailing List, Ma Shimiao
On Fri, Dec 15, 2017 at 10:58:04AM +0100, Arnd Bergmann wrote:
> As long as cft->name is guaranteed to be NUL-terminated, using strlcpy() would
> work just as well and avoid that warning, so the change below could be folded
> into that commit.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied to cgroup/for-4.15-fixes. Sorry about not responding sooner.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 9+ messages in thread
* linux-next: build warning after merge of the cgroup tree
@ 2017-05-01 4:53 Stephen Rothwell
0 siblings, 0 replies; 9+ messages in thread
From: Stephen Rothwell @ 2017-05-01 4:53 UTC (permalink / raw)
To: Tejun Heo; +Cc: Linux-Next Mailing List, Linux Kernel Mailing List
Hi Tejun,
After merging the cgroup tree, today's linux-next build (arm
multi_v7_defconfig) produced this warning:
kernel/cgroup/cgroup.c:439:13: warning: 'cgroup_get' defined but not used [-Wunused-function]
static void cgroup_get(struct cgroup *cgrp)
^
Introduced by commit
a590b90d472f ("cgroup: fix spurious warnings on cgroup_is_dead() from cgroup_sk_alloc()")
CONFIG_SOCK_CGROUP_DATA is not set for this build.
--
Cheers,
Stephen Rothwell
^ permalink raw reply [flat|nested] 9+ messages in thread
* linux-next: build warning after merge of the cgroup tree
@ 2013-08-27 10:17 Stephen Rothwell
2013-08-27 18:33 ` Tejun Heo
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Rothwell @ 2013-08-27 10:17 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-next, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 579 bytes --]
Hi Tejun,
After merging the cgroup tree, today's linux-next build (i386 defconfig)
produced this warning:
kernel/cgroup.c: In function 'css_from_id':
kernel/cgroup.c:5723:3: warning: passing argument 2 of 'cgroup_css' makes pointer from integer without a cast [enabled by default]
kernel/cgroup.c:237:36: note: expected 'struct cgroup_subsys *' but argument is of type 'int'
Introduced by commit ca8bdcaff0d7 ("cgroup: make cgroup_css() take
cgroup_subsys * instead and allow NULL subsys").
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: linux-next: build warning after merge of the cgroup tree
2013-08-27 10:17 Stephen Rothwell
@ 2013-08-27 18:33 ` Tejun Heo
0 siblings, 0 replies; 9+ messages in thread
From: Tejun Heo @ 2013-08-27 18:33 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: linux-next, linux-kernel
On Tue, Aug 27, 2013 at 08:17:16PM +1000, Stephen Rothwell wrote:
> Hi Tejun,
>
> After merging the cgroup tree, today's linux-next build (i386 defconfig)
> produced this warning:
>
> kernel/cgroup.c: In function 'css_from_id':
> kernel/cgroup.c:5723:3: warning: passing argument 2 of 'cgroup_css' makes pointer from integer without a cast [enabled by default]
> kernel/cgroup.c:237:36: note: expected 'struct cgroup_subsys *' but argument is of type 'int'
>
> Introduced by commit ca8bdcaff0d7 ("cgroup: make cgroup_css() take
> cgroup_subsys * instead and allow NULL subsys").
Yeap, the conversion missed a newly added function, which BTW
currently doesn't have any users. Applied the following fix.
Thanks a lot!
>From d1625964da51bda61306ad3ec45307a799c21f08 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Tue, 27 Aug 2013 14:27:23 -0400
Subject: [PATCH] cgroup: fix cgroup_css() invocation in css_from_id()
ca8bdcaff0 ("cgroup: make cgroup_css() take cgroup_subsys * instead
and allow NULL subsys") missed one conversion in css_from_id(), which
was newly added. As css_from_id() doesn't have any user yet, this
doesn't break anything other than generating a build warning.
Convert it.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
---
kernel/cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index e76698d..b5f4989 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5729,7 +5729,7 @@ struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss)
cgrp = idr_find(&ss->root->cgroup_idr, id);
if (cgrp)
- return cgroup_css(cgrp, ss->subsys_id);
+ return cgroup_css(cgrp, ss);
return NULL;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-07-11 2:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11 1:15 linux-next: build warning after merge of the cgroup tree Stephen Rothwell
2023-07-11 1:22 ` Tejun Heo
2023-07-11 2:06 ` Miaohe Lin
-- strict thread matches above, loose matches on Subject: below --
2017-12-13 3:56 Stephen Rothwell
2017-12-15 9:58 ` Arnd Bergmann
2017-12-15 13:10 ` Tejun Heo
2017-05-01 4:53 Stephen Rothwell
2013-08-27 10:17 Stephen Rothwell
2013-08-27 18:33 ` Tejun Heo
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.