All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-next: build warning after merge of the cgroup tree
@ 2017-05-01  4:53 Stephen Rothwell
  2017-05-01 19:41   ` Tejun Heo
  0 siblings, 1 reply; 11+ 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] 11+ messages in thread

* [PATCH cgroup/for-4.12] cgroup: mark cgroup_get() with __maybe_unused
  2017-05-01  4:53 linux-next: build warning after merge of the cgroup tree Stephen Rothwell
@ 2017-05-01 19:41   ` Tejun Heo
  0 siblings, 0 replies; 11+ messages in thread
From: Tejun Heo @ 2017-05-01 19:41 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Li Zefan,
	Johannes Weiner, cgroups

>From 310b4816a5d8082416b4ab83e5a7b3cb92883a4d Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Mon, 1 May 2017 15:24:14 -0400

a590b90d472f ("cgroup: fix spurious warnings on cgroup_is_dead() from
cgroup_sk_alloc()") converted most cgroup_get() usages to
cgroup_get_live() leaving cgroup_sk_alloc() the sole user of
cgroup_get().  When !CONFIG_SOCK_CGROUP_DATA, this ends up triggering
unused warning for cgroup_get().

Silence the warning by adding __maybe_unused to cgroup_get().

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: http://lkml.kernel.org/r/20170501145340.17e8ef86@canb.auug.org.au
Signed-off-by: Tejun Heo <tj@kernel.org>
---
Applied to cgroup/for-4.12.

Thanks!

 kernel/cgroup/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 38d9386..f2bcc11 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -436,7 +436,7 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgrp,
 	return css;
 }
 
-static void cgroup_get(struct cgroup *cgrp)
+static void __maybe_unused cgroup_get(struct cgroup *cgrp)
 {
 	css_get(&cgrp->self);
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH cgroup/for-4.12] cgroup: mark cgroup_get() with __maybe_unused
@ 2017-05-01 19:41   ` Tejun Heo
  0 siblings, 0 replies; 11+ messages in thread
From: Tejun Heo @ 2017-05-01 19:41 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List, Li Zefan,
	Johannes Weiner, cgroups

From 310b4816a5d8082416b4ab83e5a7b3cb92883a4d Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Mon, 1 May 2017 15:24:14 -0400

a590b90d472f ("cgroup: fix spurious warnings on cgroup_is_dead() from
cgroup_sk_alloc()") converted most cgroup_get() usages to
cgroup_get_live() leaving cgroup_sk_alloc() the sole user of
cgroup_get().  When !CONFIG_SOCK_CGROUP_DATA, this ends up triggering
unused warning for cgroup_get().

Silence the warning by adding __maybe_unused to cgroup_get().

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: http://lkml.kernel.org/r/20170501145340.17e8ef86@canb.auug.org.au
Signed-off-by: Tejun Heo <tj@kernel.org>
---
Applied to cgroup/for-4.12.

Thanks!

 kernel/cgroup/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 38d9386..f2bcc11 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -436,7 +436,7 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgrp,
 	return css;
 }
 
-static void cgroup_get(struct cgroup *cgrp)
+static void __maybe_unused cgroup_get(struct cgroup *cgrp)
 {
 	css_get(&cgrp->self);
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ messages in thread

* 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ 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; 11+ 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] 11+ messages in thread

end of thread, other threads:[~2023-07-11  2:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-01  4:53 linux-next: build warning after merge of the cgroup tree Stephen Rothwell
2017-05-01 19:41 ` [PATCH cgroup/for-4.12] cgroup: mark cgroup_get() with __maybe_unused Tejun Heo
2017-05-01 19:41   ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
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
2017-12-13  3:56 Stephen Rothwell
2017-12-15  9:58 ` Arnd Bergmann
2017-12-15 13:10   ` Tejun Heo
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.