diff mbox

[RESEND] mtd: refactor call to request_module

Message ID 20130708130512.GA24315@www.outflux.net
State New, archived
Headers show

Commit Message

Kees Cook July 8, 2013, 1:05 p.m. UTC
This reduces the size of the stack frame when calling request_module().
Performing the sprintf before the call is not needed.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/mtd/chips/gen_probe.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Rusty Russell July 10, 2013, 3:10 a.m. UTC | #1
Kees Cook <keescook@chromium.org> writes:
> This reduces the size of the stack frame when calling request_module().
> Performing the sprintf before the call is not needed.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Acked-by: Rusty Russell <rusty@rustcorp.com.au>

Thanks,
Rusty.

> ---
>  drivers/mtd/chips/gen_probe.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c
> index 74dbb6b..ffb36ba 100644
> --- a/drivers/mtd/chips/gen_probe.c
> +++ b/drivers/mtd/chips/gen_probe.c
> @@ -211,9 +211,7 @@ static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map,
>  
>  	probe_function = __symbol_get(probename);
>  	if (!probe_function) {
> -		char modname[sizeof("cfi_cmdset_%4.4X")];
> -		sprintf(modname, "cfi_cmdset_%4.4X", type);
> -		request_module(modname);
> +		request_module("cfi_cmdset_%4.4X", type);
>  		probe_function = __symbol_get(probename);
>  	}
>  
> -- 
> 1.7.9.5
>
>
> -- 
> Kees Cook
> Chrome OS Security
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
James Hogan July 10, 2013, 8:40 a.m. UTC | #2
On 10/07/13 04:10, Rusty Russell wrote:
> Kees Cook <keescook@chromium.org> writes:
>> This reduces the size of the stack frame when calling request_module().
>> Performing the sprintf before the call is not needed.
>>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
> 
> Acked-by: Rusty Russell <rusty@rustcorp.com.au>

I remember reviewing this before, so feel free to add my:

Reviewed-by: James Hogan <james.hogan@imgtec.com>

Cheers
James
Artem Bityutskiy Aug. 2, 2013, 3:53 p.m. UTC | #3
On Mon, 2013-07-08 at 06:05 -0700, Kees Cook wrote:
> This reduces the size of the stack frame when calling request_module().
> Performing the sprintf before the call is not needed.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>

Pushed to l2-mtd.git, thanks!
diff mbox

Patch

diff --git a/drivers/mtd/chips/gen_probe.c b/drivers/mtd/chips/gen_probe.c
index 74dbb6b..ffb36ba 100644
--- a/drivers/mtd/chips/gen_probe.c
+++ b/drivers/mtd/chips/gen_probe.c
@@ -211,9 +211,7 @@  static inline struct mtd_info *cfi_cmdset_unknown(struct map_info *map,
 
 	probe_function = __symbol_get(probename);
 	if (!probe_function) {
-		char modname[sizeof("cfi_cmdset_%4.4X")];
-		sprintf(modname, "cfi_cmdset_%4.4X", type);
-		request_module(modname);
+		request_module("cfi_cmdset_%4.4X", type);
 		probe_function = __symbol_get(probename);
 	}