mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Vivek Goyal <vgoyal@redhat.com>, Huang Ying <ying.huang@intel.com>
Cc: Will Drewry <wad@chromium.org>, Rabin Vincent <rabin@rab.in>,
	axboe@kernel.dk, linux-kernel@vger.kernel.org
Subject: Re: [alternate PATCH] block: fix UUID string buffer length
Date: Wed, 05 Oct 2011 11:18:15 -0700	[thread overview]
Message-ID: <1317838695.1782.43.camel@Joe-Laptop> (raw)
In-Reply-To: <20111005181131.GK30146@redhat.com>

On Wed, 2011-10-05 at 14:11 -0400, Vivek Goyal wrote:
> 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.

Perhaps include/linux/uuid.h could be extended to provide
some #defines for the various UUID lengths.
 



  reply	other threads:[~2011-10-05 18:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05  9:52 [PATCH] " Rabin Vincent
2011-10-05 14:41 ` Will Drewry
2011-10-05 16:48   ` [alternate PATCH] " Joe Perches
2011-10-05 18:11     ` Vivek Goyal
2011-10-05 18:18       ` Joe Perches [this message]
2011-10-05 18:24         ` Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317838695.1782.43.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rabin@rab.in \
    --cc=vgoyal@redhat.com \
    --cc=wad@chromium.org \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®