lkml.org 
[lkml]   [2021]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RESEND PATCH] x86/tools/relocs: add __printf attribute to die()
From
%zu wouldn't DTRT for cross build.

On June 24, 2021 7:44:02 AM PDT, Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>On Thu, Jun 24, 2021 at 02:32:43PM +0200, Borislav Petkov wrote:
>> On Thu, Jun 24, 2021 at 01:58:03PM +0200, Greg Kroah-Hartman wrote:
>> > There are a number of printf "mismatches" in the use of die() in
>> > x86/tools/relocs.c. Fix them up and add the printf attribute to
>the
>> > reloc.h header file to prevent them from ever coming back.
>> >
>> > Cc: Thomas Gleixner <tglx@linutronix.de>
>> > Cc: Ingo Molnar <mingo@redhat.com>
>> > Cc: Borislav Petkov <bp@alien8.de>
>> > Cc: "H. Peter Anvin" <hpa@zytor.com>
>> > Cc: linux-kernel@vger.kernel.org
>> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> > ---
>> > arch/x86/tools/relocs.c | 21 +++++++++++----------
>> > arch/x86/tools/relocs.h | 1 +
>> > 2 files changed, 12 insertions(+), 10 deletions(-)
>> >
>> > Originally sent back in Feb, but it seems to have been missed:
>> >
> https://lore.kernel.org/r/20210227095356.603513-1-gregkh@linuxfoundation.org
>> >
>> >
>> > diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
>> > index ce7188cbdae5..c3105a8c6cde 100644
>> > --- a/arch/x86/tools/relocs.c
>> > +++ b/arch/x86/tools/relocs.c
>> > @@ -389,7 +389,8 @@ static void read_ehdr(FILE *fp)
>> > Elf_Shdr shdr;
>> >
>> > if (fseek(fp, ehdr.e_shoff, SEEK_SET) < 0)
>> > - die("Seek to %d failed: %s\n", ehdr.e_shoff, strerror(errno));
>> > + die("Seek to %d failed: %s\n",
>> > + (int)ehdr.e_shoff, strerror(errno));
>>
>> Instead of casting all those, I think you should use %zu as,
>apparently,
>> we're using unsigned types for Elf{32,64}_Off and Elf{32,64}_Xword,
>etc.
>
>Odd, I thought I tried that and something did not work. Let me try it
>again...

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

\
 
 \ /
  Last update: 2021-06-25 18:19    [W:0.114 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site