From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6986242D6C for ; Mon, 4 Aug 2025 10:43:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754304209; cv=none; b=pIPbA2cQhnMOzWEAitpk7dXtS3VeWoWy3ejubxn3IMUtG0krTTSx6/Yl56gJCvC0mQrhA1dlX9YK+qNlFtodSlm+2cx4bbyMwIdYLajLso7jin2eZica7IW9Vo808cz3ScS93j3G6oaZ/BikohnT3KolZjFE7M86F7V/iQAEYfc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754304209; c=relaxed/simple; bh=LB96+Di3hQ5fF0sNfSgu5Q5TIk/SywkEtrDB5PxcLII=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MYWhFeGjCR2MUlLnhnOLSfPDXUOfDceddEebIsXv2rYXa1pX+7IsH5Z9voDr3JKe1+lH0veFmSy9Nt59eMtdXhUQqU7L0xyekW/tokZAs7sIG23avKrAhdW6VzdEbpxv/WZNKyDbUiDFmuNsLGRHArU7HEQnzgNcXb6TZIbmWs4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=eksKNcVu; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="eksKNcVu" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1754304204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OoNroIT4bEA4dsp0NfXJH1mI1a/u9RF3xG7r3lDLIMQ=; b=eksKNcVutLIW4IP3WdZEebZ1zO+hbJYr8F/8QM5wvvzWy3nTBtAcYlSdSyuJtSP4BWgMHl t0EEosaOTTAkfLs5BxlcQBuqNn1jYWHXUTfAOF5Uh84zkC4klw5TYUTXDDOCXF8k4BMoRD zjNKwHkH4A0xr0TEG3njz4mkDb5CxUU= Date: Mon, 4 Aug 2025 18:43:16 +0800 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH net-next] netfilter: clean up returns in nf_conntrack_log_invalid_sysctl() Content-Language: en-US To: Dan Carpenter , Pablo Neira Ayuso Cc: Jozsef Kadlecsik , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org References: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2025/8/4 18:35, Dan Carpenter wrote: > Smatch complains that these look like error paths with missing error > codes, especially the one where we return if nf_log_is_registered() is > true: > > net/netfilter/nf_conntrack_standalone.c:575 nf_conntrack_log_invalid_sysctl() > warn: missing error code? 'ret' > > In fact, all these return zero deliberately. Change them to return a > literal instead which helps readability as well as silencing the warning. > > Signed-off-by: Dan Carpenter LGTM, feel free to add: Acked-by: Lance Yang > --- > net/netfilter/nf_conntrack_standalone.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c > index 9b8b10a85233..1f14ef0436c6 100644 > --- a/net/netfilter/nf_conntrack_standalone.c > +++ b/net/netfilter/nf_conntrack_standalone.c > @@ -567,16 +567,16 @@ nf_conntrack_log_invalid_sysctl(const struct ctl_table *table, int write, > return ret; > > if (*(u8 *)table->data == 0) > - return ret; > + return 0; > > /* Load nf_log_syslog only if no logger is currently registered */ > for (i = 0; i < NFPROTO_NUMPROTO; i++) { > if (nf_log_is_registered(i)) > - return ret; > + return 0; > } > request_module("%s", "nf_log_syslog"); > > - return ret; > + return 0; > } > > static struct ctl_table_header *nf_ct_netfilter_header;