* [PATCH] x86/intel_rdt: fix rdt_mount error handling
@ 2016-11-08 13:42 Arnd Bergmann
2016-11-08 14:46 ` Thomas Gleixner
2016-11-08 17:23 ` Yu, Fenghua
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-11-08 13:42 UTC (permalink / raw)
To: Thomas Gleixner
Cc: Arnd Bergmann, Fenghua Yu, Ingo Molnar, H. Peter Anvin, x86,
linux-kernel
The newly introduced rdt_mount function returns an unintialized
pointer if rdtgroup_create_info_dir() fails:
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c: In function ‘rdt_mount’:
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c:710:9: error: ‘dentry’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
Clearly the intention was to propagate the error code here as we
do in the other failure cases.
Fixes: 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index a90ad22b9823..e66c7a58505e 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -691,8 +691,10 @@ static struct dentry *rdt_mount(struct file_system_type *fs_type,
closid_init();
ret = rdtgroup_create_info_dir(rdtgroup_default.kn);
- if (ret)
+ if (ret) {
+ dentry = ERR_PTR(ret);
goto out_cdp;
+ }
dentry = kernfs_mount(fs_type, flags, rdt_root,
RDTGROUP_SUPER_MAGIC, NULL);
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/intel_rdt: fix rdt_mount error handling
2016-11-08 13:42 [PATCH] x86/intel_rdt: fix rdt_mount error handling Arnd Bergmann
@ 2016-11-08 14:46 ` Thomas Gleixner
2016-11-08 17:23 ` Yu, Fenghua
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2016-11-08 14:46 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Fenghua Yu, Ingo Molnar, H. Peter Anvin, x86, linux-kernel
On Tue, 8 Nov 2016, Arnd Bergmann wrote:
> The newly introduced rdt_mount function returns an unintialized
> pointer if rdtgroup_create_info_dir() fails:
http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=x86/cache&id=7bff0af51012500718971f9cc3485f67252353eb
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] x86/intel_rdt: fix rdt_mount error handling
2016-11-08 13:42 [PATCH] x86/intel_rdt: fix rdt_mount error handling Arnd Bergmann
2016-11-08 14:46 ` Thomas Gleixner
@ 2016-11-08 17:23 ` Yu, Fenghua
1 sibling, 0 replies; 3+ messages in thread
From: Yu, Fenghua @ 2016-11-08 17:23 UTC (permalink / raw)
To: Arnd Bergmann, Thomas Gleixner
Cc: Ingo Molnar, H. Peter Anvin, x86, linux-kernel
> From: Arnd Bergmann [mailto:arnd@arndb.de]
> The newly introduced rdt_mount function returns an unintialized pointer if
> rdtgroup_create_info_dir() fails:
>
> arch/x86/kernel/cpu/intel_rdt_rdtgroup.c: In function ‘rdt_mount’:
> arch/x86/kernel/cpu/intel_rdt_rdtgroup.c:710:9: error: ‘dentry’ may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
>
> Clearly the intention was to propagate the error code here as we do in the
> other failure cases.
>
> Fixes: 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
> b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
> index a90ad22b9823..e66c7a58505e 100644
> --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
> +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
> @@ -691,8 +691,10 @@ static struct dentry *rdt_mount(struct
> file_system_type *fs_type,
> closid_init();
>
> ret = rdtgroup_create_info_dir(rdtgroup_default.kn);
> - if (ret)
> + if (ret) {
> + dentry = ERR_PTR(ret);
> goto out_cdp;
> + }
>
> dentry = kernfs_mount(fs_type, flags, rdt_root,
> RDTGROUP_SUPER_MAGIC, NULL);
The warning has been fixed and pushed in tip tree already:
http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=x86/cache&id=7bff0af51012500718971f9cc3485f67252353eb
Thanks.
-Fenghua
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-08 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08 13:42 [PATCH] x86/intel_rdt: fix rdt_mount error handling Arnd Bergmann
2016-11-08 14:46 ` Thomas Gleixner
2016-11-08 17:23 ` Yu, Fenghua
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).