Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7339815rdb; Wed, 3 Jan 2024 12:22:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVoQZRVkijnZUomaj0NVLDuaggmALS88IfS95vQpH4FpnB8rbAHHXVKZm+mdtjd/NSvsy6 X-Received: by 2002:a05:622a:1051:b0:428:1ca6:206e with SMTP id f17-20020a05622a105100b004281ca6206emr2138834qte.21.1704313373599; Wed, 03 Jan 2024 12:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704313373; cv=none; d=google.com; s=arc-20160816; b=Wh4KrKoWKJDYh23MlL0cP8CUtymiBwNU8zZVTJSm7h81ZHuHBPWBtCSEZQKQk4vu2A YCJWuhoJ/FOJjUtUAm+vTdgIbRx+pCjJVRrjj9H6/25RMST4IUIV+OcZ8rEzHiyqNwz7 C86Qow3/63iaessMd1kXWuY618lfPI5I7WOGvDkvAUFfIi/dkpXL636BCHgTZmKmq/qE KgnFJgSOP5vjPSypmp3veL4WQr1t8llFRTI+Q3L7Y4D+ol63hpNYxayXlqDssjT3vSHZ XULdj81Yys7+ctMNnpiQeNy8jtKXKyYaPqYJmPLMM36a3KhYywMZoj4UEmeQypIGPGnv D4ZQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15975-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n1-20020ac85a01000000b004254e5138fesi30119150qta.260.2024.01.03.12.22.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 12:22:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15975-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15975-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5BC021C244F7 for ; Wed, 3 Jan 2024 20:22:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 198DE1DA4A; Wed, 3 Jan 2024 20:22:09 +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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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= 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; -- 2.43.0