Re: linux-next: build warning after merge of the cgroup tree

2017-12-15 Thread Tejun Heo
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 

Applied to cgroup/for-4.15-fixes.  Sorry about not responding sooner.

Thanks.

-- 
tejun


Re: linux-next: build warning after merge of the cgroup tree

2017-12-15 Thread Tejun Heo
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 

Applied to cgroup/for-4.15-fixes.  Sorry about not responding sooner.

Thanks.

-- 
tejun


Re: linux-next: build warning after merge of the cgroup tree

2017-12-15 Thread Arnd Bergmann
On Wed, Dec 13, 2017 at 4:56 AM, Stephen Rothwell  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 

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, >cgrp.flags);
 }


Re: linux-next: build warning after merge of the cgroup tree

2017-12-15 Thread Arnd Bergmann
On Wed, Dec 13, 2017 at 4:56 AM, Stephen Rothwell  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 

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, >cgrp.flags);
 }


linux-next: build warning after merge of the cgroup tree

2017-12-12 Thread Stephen Rothwell
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


linux-next: build warning after merge of the cgroup tree

2017-12-12 Thread Stephen Rothwell
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


linux-next: build warning after merge of the cgroup tree

2017-04-30 Thread Stephen Rothwell
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


linux-next: build warning after merge of the cgroup tree

2017-04-30 Thread Stephen Rothwell
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


Re: linux-next: build warning after merge of the cgroup tree

2013-08-27 Thread Tejun Heo
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 
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 
Reported-by: Stephen Rothwell 
Reported-by: kbuild test robot 
---
 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(>root->cgroup_idr, id);
if (cgrp)
-   return cgroup_css(cgrp, ss->subsys_id);
+   return cgroup_css(cgrp, ss);
return NULL;
 }
 
-- 
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


linux-next: build warning after merge of the cgroup tree

2013-08-27 Thread Stephen Rothwell
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 Rothwells...@canb.auug.org.au


pgpRTcYyxammN.pgp
Description: PGP signature


linux-next: build warning after merge of the cgroup tree

2013-08-27 Thread Stephen Rothwell
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 Rothwells...@canb.auug.org.au


pgpRTcYyxammN.pgp
Description: PGP signature


Re: linux-next: build warning after merge of the cgroup tree

2013-08-27 Thread Tejun Heo
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 t...@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 t...@kernel.org
Reported-by: Stephen Rothwell s...@canb.auug.org.au
Reported-by: kbuild test robot fengguang...@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
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/