From patchwork Wed Jan 3 20:22:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charlie Jenkins X-Patchwork-Id: 184839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5244236dyb; Wed, 3 Jan 2024 12:23:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzxTsYroS2W5ecROJwPskaumAilXepBpK1nkPhnUwHmbO1Mi/pCGMFmLAyV4NQBTO/EKE3 X-Received: by 2002:a17:903:1211:b0:1d4:52f6:e046 with SMTP id l17-20020a170903121100b001d452f6e046mr2114959plh.58.1704313406745; Wed, 03 Jan 2024 12:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704313406; cv=none; d=google.com; s=arc-20160816; b=KZJxJtlCMYDS1F5yOR5b6/Tv9wkDN6oWT1T6ZM7ZgcpvzF/O7Gat/6uaCTMyfvcZoD RCG/QEBUxTkNL9+SHJhtSllF6YgyaNASPB7q8Nz11LBihPPISkH5NLbBJf/mHPgq9yxw Pbd+mATrNat9DVNw+lptabWyRv5Wu8db4m67cylOvN4J+ACXsO0f5Am/+61wkYXuxGgE NTI0h4shmXY+QgX1r3jvLF88CWUwyaNk3qUfHUGSgUvooH+OpSdLrsL16xNEBdpbiGCl 3sre7No1Ak8CDa76NkXKH2JGD6TScoow3CrE8RGrdNPUEvwCZG5NXCVlE2Vnwvjw8rG9 gqWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=zwpW8R3xYRcFeijiUFHaM884VPc1V+tX+SXLWnbPyzE=; fh=31PALnH5Cq0q1EcVShuOPRZ2lq7PUU43EKkNLu2N57Q=; b=y21oCAUYmliISjPi6JtDzX4llZ95iXWI8VzSYyFLq5OWs27/I60+CaIKMVX/1Hom8M L0S0U+Bm7A+whl7AVigWJJJWzGc7CF5EeaQXRQ/R/HpSph8J+MJ/ZOZb6Ie4GbCx+WdK hzB32FCT/AguDkAsRKL4yiNTHFKtYLSbjYmzuHt7FJrAU0zgROycleHPco+rdeMWkm+v 90PHVnIUzOElndXly7hz0AJXE/kd+SyKvNrb9WMxa2+Va8ikzq3uif2I/O3naj9H6BNn JiLtlvVOnhYwhNYwHNtQZGcui4E300g0Y4110Hq+F2GuosFyNLX4BPg8RpG6BLB+9cRp th1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FvoiyVz8; spf=pass (google.com: domain of linux-kernel+bounces-15975-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15975-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d6-20020a170902654600b001d3304a49cfsi21641946pln.496.2024.01.03.12.23.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 12:23:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15975-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=FvoiyVz8; spf=pass (google.com: domain of linux-kernel+bounces-15975-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15975-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 84A9C285E12 for ; Wed, 3 Jan 2024 20:23:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC6921EA85; Wed, 3 Jan 2024 20:22:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="FvoiyVz8" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3E2D1D544 for ; Wed, 3 Jan 2024 20:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d3ef33e68dso6104365ad.1 for ; Wed, 03 Jan 2024 12:22:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1704313326; x=1704918126; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zwpW8R3xYRcFeijiUFHaM884VPc1V+tX+SXLWnbPyzE=; b=FvoiyVz8QnxDL5wEGzQ3TCOKVI9NfYSTikBJGbzZmBwfKlR3gI6A39PqTm0JX9wGjZ M+X7YUXZBjN7XH0xdTvfNJJpRnHauLCSlsZ0z/RFWRshinvQ6CTD0Fw3IIxNWFdedomM cdg9QUVo+tkA9H618VV/1t8zA1dowPiSay+HRmzF8Svxp0YNEK8Tkk9kH3ZNL/HAe8Hm Yp6wFznUv1hPEDkqzmuhDwnE/vNORsJNU0r6AT1HYiDYrTUkFgptCvVZHKZ7L+ejqhNX 8YqxiJTvTXtlxpVBVSWGtYXTeZJgygwkTWo968opX5baKExExtJnxCj86nPi2ZDpN1rd j/mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704313326; x=1704918126; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zwpW8R3xYRcFeijiUFHaM884VPc1V+tX+SXLWnbPyzE=; b=IZ8XwrleDN0r81+T9e4UnDiw8zrb2naROT/dD+2eoxkhsLfpAQVRrCS0QQnk5rQoez BbfBWzqsa7ZDvnCZghDue3RJ8qyKwX3fbUCsLUDjtB1mfHyb33v8EXTZjpdSXLFQfw55 U8IH1cxTXrL23s0n1lqZQPnjMxTVtMfsUwktF9W4uN42NVCyuvqoVI8lYheGXs/9eH0h DWYMO1oHaa8ezXgEYGb325C8eJ7vLzYotV3t/54gBlc/kz1lgIQ/w6oOocIdybscL3Uh xZHAqtyMemwfhimKs+YhDrnJVRHhfccavHMebPmD3Sz/BluoY+YufzLTAI4qfwxaTeq+ btIg== X-Gm-Message-State: AOJu0YxrYr11zkC7CwQPyseu7WrQTSAWfdmNQqkjNGZoVExfkuLFtZHb 0+0oNJq/ma0nrdBL1s+AtsNNhY9ONjMDxA== X-Received: by 2002:a17:902:748c:b0:1d3:edd9:1f13 with SMTP id h12-20020a170902748c00b001d3edd91f13mr1728858pll.67.1704313326148; Wed, 03 Jan 2024 12:22:06 -0800 (PST) Received: from charlie.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id d13-20020a170903230d00b001d3fa5acf71sm24278739plh.12.2024.01.03.12.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 12:22:05 -0800 (PST) From: Charlie Jenkins Date: Wed, 03 Jan 2024 12:22:02 -0800 Subject: [PATCH v2 3/4] riscv: Fix relocation_hashtable size Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240103-module_loading_fix-v2-3-292b160552c9@rivosinc.com> References: <20240103-module_loading_fix-v2-0-292b160552c9@rivosinc.com> In-Reply-To: <20240103-module_loading_fix-v2-0-292b160552c9@rivosinc.com> To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Palmer Dabbelt , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Charlie Jenkins , kernel test robot , Julia Lawall X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1704313322; l=1020; i=charlie@rivosinc.com; s=20231120; h=from:subject:message-id; bh=js9HmT4o7o8yl7lcSP3vcOE6sOgYhIQV9xZrhoMilzw=; b=SCb2uRI3tDQm0ffD82YNnM5V07YHtzrz/w1KT4oUaF3KND9VKC87pPJdypEGMgzkkPQF9fFHn 3U5g8/i3hp1DCZbGzDsWDLQbXyWpmz3T+J+fT5KLQK7xulsUwWWSBLe X-Developer-Key: i=charlie@rivosinc.com; a=ed25519; pk=t4RSWpMV1q5lf/NWIeR9z58bcje60/dbtxxmoSfBEcs= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787102134589713647 X-GMAIL-MSGID: 1787102134589713647 A second dereference is needed to get the accurate size of the relocation_hashtable. Signed-off-by: Charlie Jenkins Fixes: d8792a5734b0 ("riscv: Safely remove entries from relocation list") Reported-by: kernel test robot Reported-by: Julia Lawall Closes: https://lore.kernel.org/r/202312120044.wTI1Uyaa-lkp@intel.com/ --- arch/riscv/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c index 32743180e8ef..ceb0adb38715 100644 --- a/arch/riscv/kernel/module.c +++ b/arch/riscv/kernel/module.c @@ -764,7 +764,7 @@ initialize_relocation_hashtable(unsigned int num_relocations, hashtable_size <<= should_double_size; *relocation_hashtable = kmalloc_array(hashtable_size, - sizeof(*relocation_hashtable), + sizeof(**relocation_hashtable), GFP_KERNEL); if (!*relocation_hashtable) return 0;