Re: [PATCH] kernel/panic.c: reduce 1 byte usage for print tainted buffer.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Al Viro:

How about 2nd patch, is it correct?

I have finished my 2 patches which for an evaluation by you.  ;-)

Thanks.

On 10/05/2013 11:50 PM, Chen Gang wrote:
> sizeof("Tainted: ") already counts '\0', and after first sprintf(), 's'
> will start from the current string end (its' value is '\0').
> 
> So need not add additional 1 byte for maximized usage of 'buf' in
> print_tainted().
> 
> 
> Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
> ---
>  kernel/panic.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/panic.c b/kernel/panic.c
> index b6c482c..c00b4ce 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -233,7 +233,7 @@ static const struct tnt tnts[] = {
>   */
>  const char *print_tainted(void)
>  {
> -	static char buf[ARRAY_SIZE(tnts) + sizeof("Tainted: ") + 1];
> +	static char buf[ARRAY_SIZE(tnts) + sizeof("Tainted: ")];
>  
>  	if (tainted_mask) {
>  		char *s;
> 


-- 
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux