* linux-next: build warning after merge of the akpm tree @ 2013-02-20 6:34 Stephen Rothwell 2013-02-20 14:37 ` Peter Jones 0 siblings, 1 reply; 4+ messages in thread From: Stephen Rothwell @ 2013-02-20 6:34 UTC (permalink / raw) To: Andrew Morton; +Cc: linux-next, linux-kernel, Peter Jones [-- Attachment #1: Type: text/plain, Size: 528 bytes --] Hi Andrew, After merging the akpm tree, today's linux-next build (powerpc ppc44x_defconfig) produced this warning: block/partitions/efi.c: In function 'is_gpt_valid': block/partitions/efi.c:324:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'unsigned int' [-Wformat] Introduced by commit ef25bb0fa6e2 ("block/partitions/efi.c: ensure that the GPT header is at least the size of the structure"). -- Cheers, Stephen Rothwell sfr@canb.auug.org.au [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* linux-next: build warning after merge of the akpm tree 2013-02-20 6:34 linux-next: build warning after merge of the akpm tree Stephen Rothwell @ 2013-02-20 14:37 ` Peter Jones 2013-02-20 14:37 ` [PATCH] block/partitions/efi.c: ensure that the GPT header is at least the size of the structure Peter Jones 0 siblings, 1 reply; 4+ messages in thread From: Peter Jones @ 2013-02-20 14:37 UTC (permalink / raw) To: Stephen Rothwell Cc: Matt Fleming, Jens Axboe, Stephen Warren, Andrew Morton, linux-kernel, linux-next Stephen, The following email is an updated patch which should fix the warning you're seeing on architectures where sizeof is unsigned int rather than unsigned long. This completely replaces the ef25bb0fa6e2 patch. Andrew, if you'd prefer a single-line fixup patch, I can send you that instead. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] block/partitions/efi.c: ensure that the GPT header is at least the size of the structure. 2013-02-20 14:37 ` Peter Jones @ 2013-02-20 14:37 ` Peter Jones 2013-02-20 21:08 ` Stephen Rothwell 0 siblings, 1 reply; 4+ messages in thread From: Peter Jones @ 2013-02-20 14:37 UTC (permalink / raw) To: Stephen Rothwell Cc: Matt Fleming, Jens Axboe, Stephen Warren, Andrew Morton, linux-kernel, linux-next, Peter Jones UEFI 2.3.1D will include a change to the spec language mandating that a GPT header must be greater than *or equal to* the size of the defined structure. While verifying that this would work on Linux, I discovered that we're not actually checking the minimum bound at all. The result of this is that when we verify the checksum, it's possible that on a malformed header (with header_size of 0), we won't actually verify any data. Signed-off-by: Peter Jones <pjones@redhat.com> Cc: Matt Fleming <matt.fleming@intel.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Stephen Warren <swarren@nvidia.com> Cc: Andrew Morton <akpm@linux-foundation.org> --- block/partitions/efi.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/block/partitions/efi.c b/block/partitions/efi.c index b62fb88..62e05cf 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c @@ -310,15 +310,23 @@ static int is_gpt_valid(struct parsed_partitions *state, u64 lba, goto fail; } - /* Check the GUID Partition Table header size */ + /* Check the GUID Partition Table header size is too big */ if (le32_to_cpu((*gpt)->header_size) > bdev_logical_block_size(state->bdev)) { - pr_debug("GUID Partition Table Header size is wrong: %u > %u\n", + pr_debug("GUID Partition Table Header size is too large: %u > %u\n", le32_to_cpu((*gpt)->header_size), bdev_logical_block_size(state->bdev)); goto fail; } + /* Check the GUID Partition Table header size is too small */ + if (le32_to_cpu((*gpt)->header_size) < sizeof(gpt_header)) { + pr_debug("GUID Partition Table Header size is too small: %u < %lu\n", + le32_to_cpu((*gpt)->header_size), + (unsigned long)sizeof(gpt_header)); + goto fail; + } + /* Check the GUID Partition Table CRC */ origcrc = le32_to_cpu((*gpt)->header_crc32); (*gpt)->header_crc32 = 0; -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] block/partitions/efi.c: ensure that the GPT header is at least the size of the structure. 2013-02-20 14:37 ` [PATCH] block/partitions/efi.c: ensure that the GPT header is at least the size of the structure Peter Jones @ 2013-02-20 21:08 ` Stephen Rothwell 0 siblings, 0 replies; 4+ messages in thread From: Stephen Rothwell @ 2013-02-20 21:08 UTC (permalink / raw) To: Peter Jones Cc: Matt Fleming, Jens Axboe, Stephen Warren, Andrew Morton, linux-kernel, linux-next [-- Attachment #1: Type: text/plain, Size: 519 bytes --] Hi Peter, On Wed, 20 Feb 2013 09:37:01 -0500 Peter Jones <pjones@redhat.com> wrote: > > + /* Check the GUID Partition Table header size is too small */ > + if (le32_to_cpu((*gpt)->header_size) < sizeof(gpt_header)) { > + pr_debug("GUID Partition Table Header size is too small: %u < %lu\n", > + le32_to_cpu((*gpt)->header_size), > + (unsigned long)sizeof(gpt_header)); Don't do this. We have %zu to print size_t variables ... -- Cheers, Stephen Rothwell sfr@canb.auug.org.au [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-20 21:08 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-02-20 6:34 linux-next: build warning after merge of the akpm tree Stephen Rothwell 2013-02-20 14:37 ` Peter Jones 2013-02-20 14:37 ` [PATCH] block/partitions/efi.c: ensure that the GPT header is at least the size of the structure Peter Jones 2013-02-20 21:08 ` Stephen Rothwell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).