Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1079636pxv; Fri, 25 Jun 2021 05:08:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrSY8rBd/8ujm0sqnlUZH87T2Bt7tCa3q6FIhL+eN64nAK9tR8OIptq8ZK1AbmCvuX7FBn X-Received: by 2002:aa7:cb19:: with SMTP id s25mr14446310edt.194.1624622905105; Fri, 25 Jun 2021 05:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624622905; cv=none; d=google.com; s=arc-20160816; b=kuR/aDHkb1JBP1KXTuuA3Yb/eyDy9hEC6oTDYZuXlT1FhFaJ2gGxVbfGRFweZLcmin rwPxy7DsmcoKrKBx9USicN5fnIe6Wbqwrs7HkJtmuSsscZBlDFC5BzEnKQhmdBRt9QEN rZbh7P6kDz07pPb9o7O6NDpUzmH3A7ZWl6L/Ing/4DbRRX10OpESLwkatQXrNez5X9JS 6RRf9LdlGpmP9dmh7bi8BtS2YK8JbiiWOBDs2/NFfNlSn1mT+qGPRf0IJKbUTgYTSRmv 55mJA9TV/a0jC1ppJdPM01ymzoti2mrknYvhWxzfJ+ut+sfnsAspMTW64f5eNWU2fsw/ tNQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=I7Bs+UA8Cke10gCAnTHEfnTbNDVBBBjIKh2jCDvAMvA=; b=rMOC+eC7uO90ZLwNVuS6HGxa9PpkobComg5iywbXhLjifa+bQKu7lYLTN2YoQKS83k HrWBXogkTrpeTQh3e++aQG5MOy3T8FKjHDVs+o2LAmRKJOVW3Vw7uMkO+a3rJSpyqijR rlwb5UwnE9Q/tDz+BbgvcJZXgZ1BC9at3kIQzvo0GfjwCKkj0xjwzMjWq3T8Mxa5Uaht nmjzu4RYtTFkDxCMn4tGLi9m9KHxp1pnByX8PckToQlrGpwvVm7rxEgKxo3MdPp6uhso xN5zyosi/25WwMgBuLOf6MBQCGR3fDLNcpccFXAc8RPJw8jKQmyrfhqflcF5mt5jWeki QOxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ibXknSS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si6852106edi.63.2021.06.25.05.08.01; Fri, 25 Jun 2021 05:08:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ibXknSS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbhFYMJY (ORCPT + 99 others); Fri, 25 Jun 2021 08:09:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbhFYMJX (ORCPT ); Fri, 25 Jun 2021 08:09:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F32561626; Fri, 25 Jun 2021 12:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1624622822; bh=090sjp2XUcitjPtdHyo/ODoO6o69If4/P/e7QRlSCac=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ibXknSS7ciZT/ilp9Pqzelxt1IW5Uk7QHioPdk7aAcYZUxaFopL1fpmS9I/nrVXti byL/Q4MAwhfPWwqMhrw7YOvq1407p9HMmknn6SlSJiuaSWuuwT8jzR2DnFNzmUGa3h J5gZ0N2QoQchpfYmj7DBYHB8rKoBwnc1VUVcpIHk= Date: Fri, 25 Jun 2021 14:06:59 +0200 From: Greg Kroah-Hartman To: Borislav Petkov Cc: x86@kernel.org, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , linux-kernel@vger.kernel.org Subject: Re: [RESEND PATCH] x86/tools/relocs: add __printf attribute to die() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > Cc: Ingo Molnar > > Cc: Borislav Petkov > > Cc: "H. Peter Anvin" > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Greg Kroah-Hartman > > --- > > 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. Ah, that does not work, I tried it and I get: arch/x86/tools/relocs.c: In function ‘read_ehdr’: arch/x86/tools/relocs.c:392:40: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 2 has type ‘Elf32_Off’ {aka ‘unsigned int’} [-Wformat=] 392 | die("Seek to %zu failed: %s\n", | ~~^ | | | long unsigned int | %u 393 | ehdr.e_shoff, strerror(errno)); | ~~~~~~~~~~~~ | | | Elf32_Off {aka unsigned int} Casting seems to be the only way to make this "quiet" that I can tell. Unless someone else has a good idea? thanks, greg k-h