From patchwork Tue Jun 13 20:30:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 107543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp809652vqr; Tue, 13 Jun 2023 13:36:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5kSC5Nu4E5+r1cqAftrhFpqobdlyEqc8W00SA+Mll7ofteIBo3kvUebVzl1PFRNyN4gI8s X-Received: by 2002:a05:6402:1294:b0:514:9dd7:4bcc with SMTP id w20-20020a056402129400b005149dd74bccmr8407495edv.14.1686688593394; Tue, 13 Jun 2023 13:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686688593; cv=none; d=google.com; s=arc-20160816; b=hAVpqxDiTKh8KziJocO/D0rlRhm8gopkm1eUT9aBuIN6TCFeVVrkQtdJCwbzsQrItl 7iLOUHIhTK6MYR/d8ApPu+sLzFGNGTHiNHpwZaO1bgyqI0nWkex1R3WPi+Qu1mBLII1R A39HXXJbRANDXMU2w5v/tDqet7KNH/JrpOsvTHKcuid5EaqoMiroQsgtxT40iODDVlxD gYjD+IHsddqWhvI+NaJMyZ023rOEI4xk57ggZfKn9DGTYwZBC/t/GZpK3hVVII12uHTA EmU6J5jOD5BYQDRwTt9nGcJMftmUGXEx6U0ytPYg4dP4OShK17kAicdFLRFInvDIIM1N n45w== 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=gWx9lNWZs+VxigmD+IrP8JxF8ho5EBghnkwdwYGkl54=; b=0LyhHIje6TUIesy2zjjbtIaU5pKPH20lPxOO01lWXCAEK5tGyPH875zR1nDrAThcDt 0kGKv4B5yrOMhDhtA72F38ZJU28l6ULRC6gQbeKSysrWM8jcukluecl4uV6CnqBK51Mi n8EBpKeeNQYu2U+tW7j2gWiVIDGJWjg0+JEywhNz0DxUgHxC2UMLC2nMzykGDc+QRrxC NMxAhX2YLurYxwrFI6aZbCs8fn4K79rmy3FFr3qEfckQAfz1QOBvewMqtO+8Evm60h42 XfRe4TfLA2ESlzPL1n5u51L1GzPKogKMWcnTytsSZJeibX7fTlTLp2G8sjSJ0GM1vLNZ UN0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=UC+22lxX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020aa7de01000000b00516a196cd21si7476534edv.691.2023.06.13.13.36.08; Tue, 13 Jun 2023 13:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=UC+22lxX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229984AbjFMUah (ORCPT + 99 others); Tue, 13 Jun 2023 16:30:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232580AbjFMUaf (ORCPT ); Tue, 13 Jun 2023 16:30:35 -0400 Received: from smtp.smtpout.orange.fr (smtp-13.smtpout.orange.fr [80.12.242.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7FE1E6C for ; Tue, 13 Jun 2023 13:30:33 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id 9AerqraEQonlZ9Aerq7ZeS; Tue, 13 Jun 2023 22:30:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1686688231; bh=gWx9lNWZs+VxigmD+IrP8JxF8ho5EBghnkwdwYGkl54=; h=From:To:Cc:Subject:Date; b=UC+22lxX0DOrviCCQcjxhM7OOu7QPNPXEZWdw363cJ/ooNvnlqq4QRmir2o8DCaM9 d1H6AhbBRhZN0inpeqmFy+E8zMrUwDwKm2BagID2B0fTywz9jOlhB0HzJ75RMh6gx2 LBs1ezgO25PKQzyo31mtp0wqGdbiaNQxKmwn1A3us4E6ZV2V7B2QiAYkSKyhMpABV6 ijQfljeLEOmI7ZM4AGYeeKYN5PD65eLjjY/CAbAuq5Bn/ySPftmZQwjrGDFlS8gFbL Nt/oLacGbpS6l6rNV+mSFV/8q0Y3n37XAd1U04unVn2mul/37yJxjVqF+mpRtF5ezH V140+EjLYbtNg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 13 Jun 2023 22:30:31 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Martin Schwidefsky , Philipp Rudo , Michael Holzheu Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-s390@vger.kernel.org Subject: [PATCH] s390/crash: Use the correct type for memory allocation Date: Tue, 13 Jun 2023 22:30:28 +0200 Message-Id: <0756118c9058338f3040edb91971d0bfd100027b.1686688212.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768621178418380549?= X-GMAIL-MSGID: =?utf-8?q?1768621178418380549?= get_elfcorehdr_size() returns a size_t, so there is no real point to store it in a u32. Turn 'alloc_size' into a size_t. Signed-off-by: Christophe JAILLET --- Not sure if 'alloc_size' can overflow in real life application, but using the correct type looks harmless. Should it be a real fix, either: Fixes: 8cce437fbb5c ("s390/kdump: Fix elfcorehdr size calculation") or Fixes: 60a0c68df263 ("[S390] kdump backend code") --- arch/s390/kernel/crash_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 8a617be28bb4..7af69948b290 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -568,9 +568,9 @@ static size_t get_elfcorehdr_size(int mem_chunk_cnt) int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size) { Elf64_Phdr *phdr_notes, *phdr_loads; + size_t alloc_size; int mem_chunk_cnt; void *ptr, *hdr; - u32 alloc_size; u64 hdr_off; /* If we are not in kdump or zfcp/nvme dump mode return */