From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 984F4388382 for ; Fri, 5 Jun 2026 20:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780692742; cv=none; b=UY8A8lNvyQjZXWMKR9VHYl3dO2MH4tAORsi/fsVltgv90rdA4VHDh54xfAq/BDOEy/uenJSQOx+rf2S1gSeoMozuLWYNYiKwgdxQLvFit3yyIP8ilebqcyfJTyonokm4EPC1D3wFsm9oeJVcoSoEqLa/Cg5bHx1k7maiCxAsf84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780692742; c=relaxed/simple; bh=xGojLbLv4NQbqNDSq+z3GuSE7kuOp9PLy2sVJwoeaRY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AR2DNK6fXDW+zHz0W2RMuEt2D2fnlTq9G0Hrg0jmcr45F0s5v73e1oaNIjey40J4Hin7c5EIMmNkmzhBTNeXG7gE69d6DqCuic9N92Qi8yrfEq6+r1b51Bx26yQl0FWtd+mboiNzUHFYI8FFb5B+ZZcOOITnKl6FBh2e5jpHvxk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=VIBVClby; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VIBVClby" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2bf22c18ad3so183415ad.0 for ; Fri, 05 Jun 2026 13:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780692741; x=1781297541; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3/aHCGrw+XIjtdqLkW4WanUic2GE7XJ8o4FzpEgOR7w=; b=VIBVClby+HSmsBRO2QbUBgCtMriMml89CTa9ChU07RJVxxe1OsWMyHU2xvWscOoqce sdBmCX2AQzE6t1uDmzhTWAZFgsIoTexNxkwx0UGmS4B+EJ0A94k6X8i33RwPD5d6FyU1 azgQ9dQe+2K9k0p2IU/hd8EJwfR/aGzzvwVR5spldUq1tS2uFE3E7IspT1ADpbb1F+Bu qQLtxtGR8eVdgsdqjsKNhLcX/1NTnCp/uhgONl/hOA9OqItSFtOiFK+Lv8IWB2j/2toZ NNs1ouBOa5/Ejp0dXZexqDl1LYut0Dk0L3CrI+Ha0UEDeerrKXuG9IwttAUs443fOvcO 1sNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780692741; x=1781297541; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3/aHCGrw+XIjtdqLkW4WanUic2GE7XJ8o4FzpEgOR7w=; b=WGZZlNACER3r+0Yld8asir6mS1bUwaL0z1iMTFkn363/Z0K957cfWJ+1aLUu+cYqqh C8tUiinXUaLNECZwYxjFriCgkak0auHDmWdULkfM5f4T5FcwujJ9jT9C0a4Waw4uSggZ ACGGXBaLVno3gS5zp/ckv0kiPl1ZTZ/kftWWdGteAhL6H9cYU7UI0NYoqoir69jb3Vqt fVokUSO7W7smnFv8WGsOhNn9Xui3N78c9tty0Zoqs/hHX8xCTbZrKVNwYQtUEpvbXyS4 EOR+3TBNOpw0NzzqCBiLEd36qBeFTSUFIFOUN9twPLCC2Hu2RZFwY7Jd+ngwrdwvWvTE bnRA== X-Forwarded-Encrypted: i=1; AFNElJ+Lr5M3Hthln+bTFeVu1Dlo0JNLLXf7ktu3SG9/jzjq0F3clen29vdRBy0slapHTtpDoFYCW+LKsM6BVMg=@vger.kernel.org X-Gm-Message-State: AOJu0YyA5YUtA0GcVcdjx5H/5kW2zMsp9jFZcgpiO93Yp+Ks2b/3by0D 7U5WMMsXS5+lcjLC2Wa30Eolhs9WMs/ynd799krvw2975kewQDNV9DWk18TglxL/nw== X-Gm-Gg: Acq92OE0CS/6x/YaQvY4ztzRcT5kwrJ+TSJUTmUFa08JAHdesFZQqbQj/lrHSVZoURo wkrtHEHbBolhqnbkErZZEl6tv2uUnHJS2Tydjoeupfu5RObE5G7qUqOP+IUPxUrcSgtfCviH+Sz ox51BS49wUAi60fPRmX6XpEggGbnfozxd6aOqBpiRsLSOdSKb8aOc6KvhtwDC5sVQjHd30qb1uf cUl5oS5bsp/5EhF1WnN0q3RILEsGttJS3DgOuit7xrVaKqp6q1HIDnmqs91P08UqBfIAp0oE8wH N4dTgRj+gWs6jWl+NpCnwrtxlIqvo1TDcn0GRBWm5xcFTsR0VfFZwCVZv0KQuydlnuQt3fE9G50 WeM+OFii1tgW0f0EsJiJztbil0CK79wwFUY4V2ag5xq8UnqIG4AbqhQKRmWQlpilvMoJy/mRAw7 YENV3HpCQc7YlQFCFVrQxgFI50eMUFvz7r1ed0hRRhdWtnkPjYQpe6jJInoi05RJItBUOrJsHGS SXtpDc= X-Received: by 2002:a17:903:910:b0:2c1:4a67:5f31 with SMTP id d9443c01a7336-2c1eb0c6c40mr2000735ad.9.1780692740156; Fri, 05 Jun 2026 13:52:20 -0700 (PDT) Received: from google.com (171.46.125.34.bc.googleusercontent.com. [34.125.46.171]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c164fa00b3sm96312575ad.32.2026.06.05.13.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 13:52:19 -0700 (PDT) Date: Fri, 5 Jun 2026 20:52:15 +0000 From: Sami Tolvanen To: Naveen Kumar Chaudhary Cc: mcgrof@kernel.org, petr.pavlu@suse.com, da.gomez@kernel.org, atomlin@atomlin.com, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] module: procfs: fix signed integer overflow in module_total_size() Message-ID: <20260605205215.GA3054112@google.com> References: <2k7x7245kygzpa5wzssebsrt5ivpykvvoeiljb5at2yiwgp4fy@fqkcethe4hyx> 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=us-ascii Content-Disposition: inline In-Reply-To: <2k7x7245kygzpa5wzssebsrt5ivpykvvoeiljb5at2yiwgp4fy@fqkcethe4hyx> On Wed, Jun 03, 2026 at 09:54:11PM +0530, Naveen Kumar Chaudhary wrote: > module_total_size() accumulates unsigned section sizes into a signed int > before returning as unsigned int. If the total exceeds INT_MAX, this is > signed integer overflow. This doesn't sound accurate to me. The compiler performs an implicit type conversion, but there's no signed integer overflow: https://godbolt.org/z/hzGrYMsPW > Change the accumulator to unsigned int to match the return type. > > Signed-off-by: Naveen Kumar Chaudhary > --- > kernel/module/procfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/module/procfs.c b/kernel/module/procfs.c > index 0a4841e88adb..90712aa9dd13 100644 > --- a/kernel/module/procfs.c > +++ b/kernel/module/procfs.c > @@ -64,7 +64,7 @@ static void m_stop(struct seq_file *m, void *p) > > static unsigned int module_total_size(struct module *mod) > { > - int size = 0; > + unsigned int size = 0; While there's no behavioral difference, using unsigned int seems like good hygiene. With the commit message corrected: Reviewed-by: Sami Tolvanen Sami