From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 CE82F3932C2 for ; Wed, 17 Jun 2026 21:46:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781732802; cv=none; b=hodNVypHOWZra3/9tCIrNDGvDSfXekzRRtzRYZm6WyLo57Ga5EmqmgCE/ebJ6SwT9qS60/ILlduX9Fr9P2sTTAxozBwdCaNUQmdlZbeyRXwIYtV1sylwwKnPVLAKNEAR9MXcPSToZ4n847WYKCzMfbbh0I9HtnFHtD2LW+6maJM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781732802; c=relaxed/simple; bh=B3YNCCU3Rk8SaouEBFlE0myl4qXDShsUV7b0iDM/Dzo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=j7Hlie6EgUkKoqsGhiZu2uG/ILmEZggxO9RncEaO4HpzTLX0kOwMH5RJ/XoJykO5IMG8l9C71goviHADwyCJhK80E18vfX4wXcXxuOBeY8aWL50eV0pQExBD8kKQmI4nEEeC65JpK23mETyhdoFGYnA2uIH79cqV1lhjs2Ten2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=oiYF93Jb; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oiYF93Jb" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2bf20f6be6bso1534435ad.3 for ; Wed, 17 Jun 2026 14:46:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781732800; x=1782337600; 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=Ldvcow43iF9SpjScIRNlK9Yg1AzDJ3co3e/z/l84bQU=; b=oiYF93JbmA0PU1yFiQReIuFpirK9f1vC43rbMcdPappKm87WMXEYBFuR0Qi5JXX0t7 rwZMOA+RiQjL1bXBMTAcie+aUyAwOlt72PeG2IfrmPq8vNzQyv0hbOt2z0kNUCv2sAdJ G5A9+LXQHnFDas7/rY0l86ODKXnzrTkUHfBpop+AfEM4XFGawnFTki3HswCkOS54N30G NyJ3AvKSU/HT9i1T8mGx01+Phs/cKSowa4eKCwR50Gr9cgR5EqpZolgQCD0njpcKxJiw XNVuomSr3qhqw316qHkgHYY97V6n2Fo4LUoM4v1p8vgdNUW3Mr4o4XH7pk0IFK3dWmSB fLjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781732800; x=1782337600; 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=Ldvcow43iF9SpjScIRNlK9Yg1AzDJ3co3e/z/l84bQU=; b=H+cS1SZjNcsluoiOdg7b2taWroigZ+2sLcvAlnUC5XDGudrkdm/vMoQyxHKpd7VtG0 miITUMpvxzAOWsZYkLN7bLNBb9lQRK63fJQWoknOydkAIGGILVesMEnCOXJMNIbD938O OOGxrH9tFHXUtwU8YDYdksNFRkN4Aczs7Ljn+xl8NOJ3MS1RJFhvYi4WHCq+nzgkoNoG 46CJ/agdY7N05F0jpGLXmcrPbX3p3KKc58X89DgiAJoNjc1y3x2c8KbMWmFTgiRq9dSR 5xZccIgMtYMvDp5Tl8zdFiW/etFTzekf/cKGdwGpr/A/ZAnPQoDWC4tnMCxPc3CFSvtn vJBw== X-Forwarded-Encrypted: i=1; AFNElJ+m5cQfjUkT095atf4Db5YQOra7YnDEpEanMYfNT5Rz9ovA5lzIc7iYTEnAw7N4oUUiAud1ycQX5Dnqkfc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw/dnBCG5vvOANwsik9ACHi9sVLoSozeE3q0ndKRdz8p9AW3kVd tIkrS0b/zgfcZbGsuDnqApjkaQMN1GkV41DyfOIEvCC8Y1mupVYYG4lc X-Gm-Gg: AfdE7cnVkUup7/oaoxDnsAdxiLqJTZ3Zvv/n8Tl5clUBVdsV2JH73oCVA1anE4b++9t ZOu2/ZZh3gD1+KiD+sAp7cvXeaRE/KUgsbSXeqV6oFoKEP/V/dUTFEQHLz1hJ5zy+NqkvM1HipE Xd+waLb7CZyPCO5wNW7vcbJNEwOwrR8zojs+wiZ3MwbszGmWl0sMvGWrOy9EoY4bryZNAFNqF+g t1NvKTgqsQNu4/OVj+rCcDVD6bqEqRCBHNrz3lXFsRWH8T+vOWPtmWFED8RRka3TU9scd6ZH9YJ oAcYYe2bH3HqYwXbt5xnvVQWsxDAV/UnlxveXQ+7vnOTRpY1QPX+fY4uMBI+/RQNzbKO0CydTrv Ig3URCmvjrIjgxQ1PRXXk9S+LiEmIeJPGKZiWebuXhuf3dJByq8W1z6gLzPpECScG9mr69xbjyn HH32+85iUolE/s4p9f X-Received: by 2002:a17:903:2b0f:b0:2c6:6424:c79f with SMTP id d9443c01a7336-2c6bbf98e47mr59486285ad.8.1781732800024; Wed, 17 Jun 2026 14:46:40 -0700 (PDT) Received: from soyboi ([2402:8780:1073:857b:d001:f2a2:fc3a:85db]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c433558449sm181860165ad.78.2026.06.17.14.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2026 14:46:39 -0700 (PDT) Date: Thu, 18 Jun 2026 04:46:35 +0700 From: Robertus Diawan Chris To: Nathan Chancellor Cc: nsc@kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, skhan@linuxfoundation.org, me@brighamcampbell.com Subject: Re: [PATCH] modpost: release allocation when early return no suffix .o in read_symbols() Message-ID: <20260617214635.GA4766@soyboi> References: <20260610052550.187006-1-robertusdchris@gmail.com> <178167011232.2064238.5669414796099955471.b4-review@b4> 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: <178167011232.2064238.5669414796099955471.b4-review@b4> Hello Nathan, On Tue, Jun 16, 2026 at 09:21:52PM -0700, Nathan Chancellor wrote: > On Wed, 10 Jun 2026 12:25:50 +0700, Robertus Diawan Chris wrote: > > diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c > > index abbcd3fc1394..8e231544f9f3 100644 > > --- a/scripts/mod/modpost.c > > +++ b/scripts/mod/modpost.c > > @@ -1585,6 +1585,7 @@ static void read_symbols(const char *modname) > > > > if (!strends(modname, ".o")) { > > error("%s: filename must be suffixed with .o\n", modname); > > + parse_elf_finish(&info); > > return; > > } > > > > Thanks for the patch! While this change appears to be correct, would > moving the strends() if block before the parse_elf() one resolve this as > well? Yes, moving the strends() if block before the parse_elf() also resolve this too. The reason I didn't do that because I am still not sure if changing the order will have any effect. I already take a look at the code and it looks like strends() if block and the parse_elf() didn't depends on each other, but just in case I missed something, I decided not to change the execution order and just add parse_elf_finish(). > I think I would prefer going that route because neither check really > depends on the other and we have to think less about unwinding > with the checks flipped. Now that you already confirm that neither check depends on each other, I am more confident to take this approach. > Furthermore, modpost is a relatively short running host utility, so > I don't really think it is worth optimizing for resource leaks like > this. I want to confirm something first, do you mind if I send v2 patch with the change of moving strends() if block before parse_elf() in read_symbols()? I mean, if you feel like this is unnecessary, I will drop this patch. I don't mind either way. Thank you for the feedback. Best regards, Robertus Diawan Chris