From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933237Ab1JESLk (ORCPT ); Wed, 5 Oct 2011 14:11:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2465 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932812Ab1JESLj (ORCPT ); Wed, 5 Oct 2011 14:11:39 -0400 Date: Wed, 5 Oct 2011 14:11:31 -0400 From: Vivek Goyal To: Joe Perches Cc: Will Drewry , Rabin Vincent , axboe@kernel.dk, linux-kernel@vger.kernel.org Subject: Re: [alternate PATCH] block: fix UUID string buffer length Message-ID: <20111005181131.GK30146@redhat.com> References: <1317808364-21081-1-git-send-email-rabin@rab.in> <1317833310.1782.33.camel@Joe-Laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1317833310.1782.33.camel@Joe-Laptop> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > cc: Will Drewry > Signed-off-by: Joe Perches > --- > 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