public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* does "block: add secure discard" cause an overflow?
@ 2010-09-03  9:16 Dan Carpenter
  2010-09-04  6:41 ` Adrian Hunter
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-09-03  9:16 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-kernel, Jens Axboe

This is the commit 8d57a98ccd0b44 "block: add secure discard".

The patch adds a letter 'E' to the string in blk_fill_rwbs().
        if (rw & REQ_SECURE)
                rwbs[i++] = 'E';

The problem is that "rwbs" is a 6 character buffer and if all the flags
are set the we'd get "WABSME" which would put us off the end (when you
add the NUL terminator).

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: does "block: add secure discard" cause an overflow?
  2010-09-03  9:16 does "block: add secure discard" cause an overflow? Dan Carpenter
@ 2010-09-04  6:41 ` Adrian Hunter
  0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2010-09-04  6:41 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Adrian Hunter, linux-kernel, Jens Axboe

Dan Carpenter wrote:
> This is the commit 8d57a98ccd0b44 "block: add secure discard".
> 
> The patch adds a letter 'E' to the string in blk_fill_rwbs().
>         if (rw & REQ_SECURE)
>                 rwbs[i++] = 'E';
> 
> The problem is that "rwbs" is a 6 character buffer and if all the flags
> are set the we'd get "WABSME" which would put us off the end (when you
> add the NUL terminator).

E goes with D which will not have either A or M, so there will not be
a rwbs with E that has more than 5 characters.

> 
> regards,
> dan carpenter
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-04  6:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-03  9:16 does "block: add secure discard" cause an overflow? Dan Carpenter
2010-09-04  6:41 ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox