lkml.org 
[lkml]   [2011]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [alternate PATCH] block: fix UUID string buffer length
On Wed, Oct 05, 2011 at 09:48:30AM -0700, Joe Perches wrote:
> The UUID string buffer is several bytes shorter than what is actually
> required. Fix it and remove the used once inline part_unpack_uuid,
> use snprintf and printf extension %pU directly.
>
> Based-on-a-patch-by: Rabin Vincent <rabin@rab.in>
> cc: Will Drewry <wad@chromium.org>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> block/genhd.c | 8 +++++---
> include/linux/genhd.h | 6 ------
> 2 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/block/genhd.c b/block/genhd.c
> index e2f6790..427c955 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -735,7 +735,7 @@ void __init printk_all_partitions(void)
> struct hd_struct *part;
> char name_buf[BDEVNAME_SIZE];
> char devt_buf[BDEVT_SIZE];
> - u8 uuid[PARTITION_META_INFO_UUIDLTH * 2 + 1];
> + char uuid[sizeof("12345678-1234-1234-1234-123456789012")];

will following look better.

char uuid [PARTITION_META_INFO_UUIDLTH * 2 + 5]

4 bytes for hyphen and 1 for NULL.

Thanks
Vivek


\
 
 \ /
  Last update: 2011-10-05 20:13    [W:0.031 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site