From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF66DC77B61 for ; Mon, 27 Mar 2023 14:58:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232725AbjC0O6v (ORCPT ); Mon, 27 Mar 2023 10:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233121AbjC0O6r (ORCPT ); Mon, 27 Mar 2023 10:58:47 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEFB149E9; Mon, 27 Mar 2023 07:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=cE0RQJv+FQscAn7Kg18zI4d5MgKmBRB/NIb1/jav8Js=; b=Qjf6fdufszYfPvYeyKk/7u11qa 9K6I5TfacvrDxJyo0Sf077teARpsMFYaxJmPUM+beCxy0yUkgEI6uV1jo79+LWq0LFetIKlSHsYrG eLggNARQNmV+huipzexYXs2GdFhqoV8pOKRRcuxbFljiEFsP/k1EIaljZhsmIGah/2mj459hIMbas jRpzXJvJSdIb8R/EhpVgnu9jDMNCfIubiUXgfFnXy7Mp707oebFYE2XDNvwOnBcgU5FUOYQ70FmLy 8GAJVbV/rJ2J+8t/QU5CAqhj8wcYXf+RQxG+qBqodbdaFhVhU5n5lYVORJ6cGqaraUNDl1+chJGdF 7rvddM+A==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pgoIZ-007UFv-V7; Mon, 27 Mar 2023 14:58:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5454A3001E5; Mon, 27 Mar 2023 16:58:13 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 17AE62111BE15; Mon, 27 Mar 2023 16:58:13 +0200 (CEST) Date: Mon, 27 Mar 2023 16:58:13 +0200 From: Peter Zijlstra To: Adrian Hunter Cc: Markus Elfring , kernel-janitors@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Sandipan Das , Thomas Gleixner , Zhouyi Zhou , x86@kernel.org, cocci@inria.fr, LKML Subject: Re: [PATCH resent] perf/x86/amd/uncore: Fix exception handling in amd_uncore_cpu_up_prepare() Message-ID: <20230327145813.GA11425@hirez.programming.kicks-ass.net> References: <3a35fb28-5937-72f8-b2e8-b1d9899b5e43@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 27, 2023 at 12:11:54PM +0300, Adrian Hunter wrote: > On 25/03/23 16:15, Markus Elfring wrote: > > Date: Fri, 17 Mar 2023 13:13:14 +0100 > > > > The label “fail” was used to jump to another pointer check despite of > > the detail in the implementation of the function “amd_uncore_cpu_up_prepare” > > that it was determined already that the corresponding variable contained > > a null pointer (because of a failed function call in two cases). > > > > 1. Thus return directly after a call of the function “amd_uncore_alloc” > > failed in the first if branch. > > > > 2. Use more appropriate labels instead. > > > > 3. Reorder jump targets at the end. > > > > 4. Delete a redundant check and kfree() call. > > > > 5. Omit an explicit initialisation for the local variable “uncore_llc”. > > > > > > This issue was detected by using the Coccinelle software. > > > > Fixes: 39621c5808f5dda75d03dc4b2d4d2b13a5a1c34b ("perf/x86/amd/uncore: Use dynamic events array") > > Fixes: 503d3291a937b726757c1f7c45fa02389d2f4324 ("perf/x86/amd: Try to fix some mem allocation failure handling") > > Commit should be only the first 12 characters of the hash. > Refer: https://docs.kernel.org/process/submitting-patches.html > > But this is not a fix. Redundant calls to kfree do not break > anything. > > Also avoid using the term "exception" since, in x86, exceptions are > hardware events. Better to just call it "error handling". Don't feed the trolls; Markus is a bot or other weird construct that's been banned from lkml.