From: Behan Webster <behanw@converseincode.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org, Mark Charlebois <charlebm@gmail.com>
Subject: Re: [PATCH] Remove VLAIS usage from JBD2 code
Date: Tue, 30 Oct 2012 15:02:43 -0400 [thread overview]
Message-ID: <50902453.9090404@converseincode.com> (raw)
In-Reply-To: <20121030190032.GB5044@thunk.org>
On 12-10-30 03:00 PM, Theodore Ts'o wrote:
> On Tue, Oct 30, 2012 at 02:40:04PM -0400, Behan Webster wrote:
>> From: Mark Charlebois <charlebm@gmail.com>
>>
>> The use of variable length arrays in structs (VLAIS) in the Linux Kernel code
>> precludes the use of compilers which don't implement VLAIS (for instance the
>> Clang compiler). Since ctx is always a 32-bit CRC, hard coding a size of 4
>> bytes accomplishes the same thing without the use of VLAIS. This is the same
>> technique already employed in fs/ext4/ext4.h
>>
>> Signed-off-by: Mark Charlebois <charlebm@gmail.com>
>> Signed-off-by: Behan Webster <behanw@converseincode.com>
> That's reasonable, but in order to be safe to make sure we don't
> accidentally introduce a stack overrun bug at some point in the
> future, we should do something like this instead
>
> + #define JBD_MAX_CHECKSUM_SIZE 4
> .
> .
> .
>
> - char ctx[crypto_shash_descsize(journal->j_chksum_driver)];
> + char ctx[JBD_MAX_CHECKSUM_SIZE];
> .
> .
> .
> + BUG_ON(crypto_shash_descsize(journal->j_chksum_driver) >
> + JBD_MAX_CHECKSUM_SIZE);
>
>
> I just like being careful and paranoid; using magic numeric constants
> for buffer sizes is just a scary thing to do. If you could resubmit
> the patch with this change, I'd really appreciate it. Thanks!!
A very good idea. Will do. Expect it soon.
Behan
--
Behan Webster
behanw@converseincode.com
next prev parent reply other threads:[~2012-10-30 19:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-30 18:40 [PATCH] Removing the use of VLAIS from the Linux Kernel Behan Webster
2012-10-30 18:40 ` [PATCH] Remove VLAIS usage from JBD2 code Behan Webster
2012-10-30 19:00 ` Theodore Ts'o
2012-10-30 19:02 ` Behan Webster [this message]
2012-10-30 19:13 ` Darrick J. Wong
2012-11-08 15:53 ` Theodore Ts'o
2012-11-09 23:19 ` Darrick J. Wong
2012-11-09 23:24 ` Darrick J. Wong
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=50902453.9090404@converseincode.com \
--to=behanw@converseincode.com \
--cc=charlebm@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.