From patchwork Wed Sep 27 13:29:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Ungerer X-Patchwork-Id: 145392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2646791vqu; Wed, 27 Sep 2023 06:57:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDzFaa2Sj6XnvnNCSIu6+Qo0fHP4MKFLgSnOpj0/Brwd1zz0/5b133na1NX75eY207Oy2E X-Received: by 2002:a05:6a00:170f:b0:692:a727:1fdd with SMTP id h15-20020a056a00170f00b00692a7271fddmr2577590pfc.4.1695823044768; Wed, 27 Sep 2023 06:57:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695823044; cv=none; d=google.com; s=arc-20160816; b=PgEZnviSmuq4WjQqzP4V1pzlcIwcMGqN8oPp8uTCeuVfKT0RhzZqqhak8SMFwwcPSP yqk8T7rsQKomnXaiAdwLk0aTtrnNaKvvIPGXzRmMniayIFm/C8MDkM6gSpdoCl6Xr2Nx RUO9iUOZ10szUqE8KSPQHFbZKadsjCdCjfTKk44frwYceOq+MlH9dHoXhLcEBhYP+U1p B1vU5ln6usss/uShjcK/+fjZnUd1StwFMrRoH4LuETKZkFjKgWao7A9mINkd6N8V/9id z96qmbzBTfPzGmHVR0osh6gxUgrsAO7TBWZrt5WQDiYWCmEkRMAUzCfNQe+g3/pKE9Ys HtGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=cvShlGfm3UA3t2OHVkHEYHsiPN6k32WqXADHgzEWyW4=; fh=Nc9/FiFsCMTxjSS8mHBTMqhCwAoriWkMAzc4hhbiATg=; b=ni/84TR8aj5ODshrzsvhYe9scMQQQwmHBRPTcwvREfcNcc64YDEN46itm7fct0CCNm 1DFOfJ83Sv3IuGG2xrwWIvSvMHHd3HAagubYJoVuGiVfH2AuVzEx4u+a2chDNXIoH3uw 3XUmLiD/fzDVmb+MmivnM82ev/InrRt19ALRhA634zhz8LmzdWZlJPKK1Pkv0NOgXvPn Wx63GxDgja0ge6cbeo2K79QlsR1HjYF5l4XJoJcMXq01AjCesDm5ppRb4JFhE6Ba8Vbc CwKAbog7vKolQhfCX9LcXD26pTqL3sFkXOJbYpnaxBZyEVbgHbSmIWdtY0zDWFLXr06g VWdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efQ5Qou8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ei19-20020a056a0080d300b00690f0a78ecesi14399003pfb.315.2023.09.27.06.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 06:57:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efQ5Qou8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 994C5806BE02; Wed, 27 Sep 2023 06:30:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231929AbjI0N3w (ORCPT + 21 others); Wed, 27 Sep 2023 09:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbjI0N3u (ORCPT ); Wed, 27 Sep 2023 09:29:50 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84B26121; Wed, 27 Sep 2023 06:29:49 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DE94C433C7; Wed, 27 Sep 2023 13:29:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695821389; bh=HP0v40iSx8Vr8h/BjmerjsuwLjXNU/N7N3nzZW+WetY=; h=From:To:Cc:Subject:Date:From; b=efQ5Qou8ufF+JGMgMJavR2QSr4mopBd2oEsorbMTk3whH2K6Q3uv/3pXPVQFTn/ob qR+YiThAyNRbuwS98TNG/xzxml1jOpxBOsVFGhhX7rtenixlPJKcZsRNOjbmnShWMs m6O1/IvK7TIu2bSF3WnUkhCyojXYmQt2ASPlXRfsfVkpzDh7cZy/AIK7Xbp6DYEAuS SNGC+Ilnzo3x5xTNYmEcMWz4nzygVpDFmVX1ednK673veM50QScCU6FsVYmT592ORQ gyGibnwc6goWufL/kBuGGuawKWmj+/QCDQqba8m8F+3PHB1MG4lRSCcFQ87ecFRWN5 Q1L8QYAcMmFBg== From: Greg Ungerer To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: palmer@rivosinc.com, keescook@chromium.org, ebiederm@xmission.com, brauner@kernel.org, viro@zeniv.linux.org.uk, Greg Ungerer Subject: [PATCH] binfmt_elf_fdpic: clean up debug warnings Date: Wed, 27 Sep 2023 23:29:33 +1000 Message-Id: <20230927132933.3290734-1-gerg@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 27 Sep 2023 06:30:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778199345330650607 X-GMAIL-MSGID: 1778199345330650607 The binfmt_elf_fdpic loader has some debug trace that can be enabled at build time. The recent 64-bit additions cause some warnings if that debug is enabled, such as: fs/binfmt_elf_fdpic.c: In function ‘elf_fdpic_map_file’: fs/binfmt_elf_fdpic.c:46:33: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Elf64_Addr’ {aka ‘long long unsigned int’} [-Wformat=] 46 | #define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ ) | ^~~~~~~~ ./include/linux/printk.h:427:25: note: in definition of macro ‘printk_index_wrap’ 427 | _p_func(_fmt, ##__VA_ARGS__); \ | ^~~~ Cast values to the largest possible type (which is equivilent to unsigned long long in this case) and use appropriate format specifiers to match. Fixes: b922bf04d2c1 ("binfmt_elf_fdpic: support 64-bit systems") Signed-off-by: Greg Ungerer --- fs/binfmt_elf_fdpic.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index 43b2a2851ba3..97c3e8551aac 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c @@ -900,10 +900,12 @@ static int elf_fdpic_map_file(struct elf_fdpic_params *params, kdebug("- DYNAMIC[]: %lx", params->dynamic_addr); seg = loadmap->segs; for (loop = 0; loop < loadmap->nsegs; loop++, seg++) - kdebug("- LOAD[%d] : %08x-%08x [va=%x ms=%x]", + kdebug("- LOAD[%d] : %08llx-%08llx [va=%llx ms=%llx]", loop, - seg->addr, seg->addr + seg->p_memsz - 1, - seg->p_vaddr, seg->p_memsz); + (unsigned long long) seg->addr, + (unsigned long long) seg->addr + seg->p_memsz - 1, + (unsigned long long) seg->p_vaddr, + (unsigned long long) seg->p_memsz); return 0; @@ -1082,9 +1084,10 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, maddr = vm_mmap(file, maddr, phdr->p_memsz + disp, prot, flags, phdr->p_offset - disp); - kdebug("mmap[%d] sz=%lx pr=%x fl=%x of=%lx --> %08lx", - loop, phdr->p_memsz + disp, prot, flags, - phdr->p_offset - disp, maddr); + kdebug("mmap[%d] sz=%llx pr=%x fl=%x of=%llx --> %08lx", + loop, (unsigned long long) phdr->p_memsz + disp, + prot, flags, (unsigned long long) phdr->p_offset - disp, + maddr); if (IS_ERR_VALUE(maddr)) return (int) maddr; @@ -1146,8 +1149,9 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *params, #else if (excess > 0) { - kdebug("clear[%d] ad=%lx sz=%lx", - loop, maddr + phdr->p_filesz, excess); + kdebug("clear[%d] ad=%llx sz=%lx", loop, + (unsigned long long) maddr + phdr->p_filesz, + excess); if (clear_user((void *) maddr + phdr->p_filesz, excess)) return -EFAULT; }