From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 1C8D61EA76; Tue, 30 May 2023 18:26:50 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-30ad458f085so126797f8f.0; Tue, 30 May 2023 11:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685471208; x=1688063208; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject:from:to:cc :subject:date:message-id:reply-to; bh=hfAiPhU6K+BMQeqpdySZgN46jLEtUlo38yIT0HEk7Yc=; b=a3afgIpHXLDR+p6PUE88imzl1Fdd3I+Pd3mtn9+XPydzdk5TMgUOew7LiZopkYPuLA QdollxMgOifJ2zwonHK94N/UfFJloiAKymBvDgx7D/aA5zL95o3CoseMcbTnEjPLvnUm F5uT+JKIHlmS0rD8+QtE3uWgNSFkrG3v/h7zpF6OEF6dVru9qT6zyYTdulwsopUVPRsn 4O15lj6YRKmXGdSf1l5rUAI0yF/PeHw+H9QLfUJYZPhQGoeylsAc6z7mBQdZAE0V18mQ 8lCJr9MQ1lniDlerRHDsW3FYnP1+U67P8VPGJlIVX0D5JVVvuUYYPeoMCcDrNrUsKolW R+rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685471208; x=1688063208; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hfAiPhU6K+BMQeqpdySZgN46jLEtUlo38yIT0HEk7Yc=; b=Ngi9qPARlZ/aYGopHheWa0aH8XuroEAOQS3agTbvtpQG5wjWNl5KNNizT3bB1DUA3e HeKWB/O5tu0fYbhxnP3TdQ70S+9cW0zWYhIJtzsPgS96iFnjo5/t8nGzt2j48aGNEcZC 5RSwrGN1wmjS1FJjYDjtmtMpI0/A4fJgR8mVmk7fT4glyuXGryYMZ0pIompsZXNaKY9I Ri9WQO9h453gEz34HWu8/PW/FH8fFTcTKvpFvgkM40fXH420+OfgR4hVI5xaC37d15dI OdqJpXbf3lX81utrCxeZZTgZK2KqfTWqWW9iLnHJG9nlpck0Ci175Ty+9yuIyLFNtQ6v tdKA== X-Gm-Message-State: AC+VfDzxHWo0Cj54GZo7OqD0NoCK/MXL1uqo+eDPyd8jxdmx+TvBJmq8 3GUmTYoH0MPaW+4sWjuC5/0= X-Google-Smtp-Source: ACHHUZ5aG44i0I28ueBuL5OztclzexCR7D7YTc0Yrd8/OnoqXdXXyvWoHZ9uq94s9h334lCsqCSVUg== X-Received: by 2002:a5d:6984:0:b0:30a:8fc5:4411 with SMTP id g4-20020a5d6984000000b0030a8fc54411mr10453969wru.32.1685471208102; Tue, 30 May 2023 11:26:48 -0700 (PDT) Received: from [192.168.1.122] (cpc159313-cmbg20-2-0-cust161.5-4.cable.virginm.net. [82.0.78.162]) by smtp.gmail.com with ESMTPSA id p17-20020a056000019100b00306415ac69asm4029180wrx.15.2023.05.30.11.26.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 May 2023 11:26:47 -0700 (PDT) Subject: Re: drivers/net/ethernet/sfc/tc.c:450 efx_tc_flower_replace() warn: missing unwind goto? To: Dan Carpenter , oe-kbuild@lists.linux.dev Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org, Simon Horman References: From: Edward Cree Message-ID: <4eabd7b1-66b3-7b3a-cabd-d1876767c49c@gmail.com> Date: Tue, 30 May 2023 19:26:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Precedence: bulk X-Mailing-List: oe-kbuild@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit On 20/05/2023 09:32, Dan Carpenter wrote: > b7f5e17b3bb961 Edward Cree 2023-03-27 432 if (efx_tc_match_is_encap(&match.mask)) { > b7f5e17b3bb961 Edward Cree 2023-03-27 433 NL_SET_ERR_MSG_MOD(extack, "Ingress enc_key matches not supported"); > b7f5e17b3bb961 Edward Cree 2023-03-27 434 rc = -EOPNOTSUPP; > b7f5e17b3bb961 Edward Cree 2023-03-27 435 goto release; > > This goto confuses Smatch. It could be converted to a direct return. [...] > d902e1a737d44e Edward Cree 2022-09-26 456 if (old) { > d902e1a737d44e Edward Cree 2022-09-26 457 netif_dbg(efx, drv, efx->net_dev, > d902e1a737d44e Edward Cree 2022-09-26 458 "Already offloaded rule (cookie %lx)\n", tc->cookie); > d902e1a737d44e Edward Cree 2022-09-26 459 rc = -EEXIST; > d902e1a737d44e Edward Cree 2022-09-26 460 NL_SET_ERR_MSG_MOD(extack, "Rule already offloaded"); > d902e1a737d44e Edward Cree 2022-09-26 461 goto release; > > It looks like this error path is problematic because it will remove the > existing rule from the list. Better to just do: > > if (old) { > netif_dbg(...); > NL_SET_ERR_MSG_MOD(extack, "Rule already offloaded"); > kfree(rule); > return -EEXIST; > } Agreed on both counts. (Technically we could add a new goto label in the failure ladder to just do the kfree and return, but this is probably clearer.) Guess efx_tc_flower_replace_foreign() now has the latter problem too? (And it _does_ want to use the failure ladder, because we've got to release the encap match.) Thanks for catching this. Patch for 'net' to follow shortly. -ed