Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4711824ybc; Tue, 26 Nov 2019 13:24:23 -0800 (PST) X-Google-Smtp-Source: APXvYqz2EKiyOIUpQgrwDBNjY5Quy4x1ZU1sKmo/GuwLQf6JYS0dFz/vnDjyllbryT+CtpUZIjXQ X-Received: by 2002:a05:6402:1515:: with SMTP id f21mr3854756edw.224.1574803463725; Tue, 26 Nov 2019 13:24:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574803463; cv=none; d=google.com; s=arc-20160816; b=b/y6wYCcCxyFOQlDe7D2WWD0P5BR5dHuweGyzxdkEi14kMnQC6khOFrf5bpwC63L5F RrKBaD2dxL4wjTnW6hr3SSUAlJm7fiNMvFrdsCS5NZK667fv8CtgB/yDeEexJ2QiD5lT Rz010AvpfdFqbgBgiKpo9RF0vdJS77u2OvSygkeIWe1WrJs0sQ5iLETwPT3ugFstW8Nt zEN0Zs8PceV+wMHLU5x3X33EnaSl2AuxeCQtZJQ/EuSqs+myYcoknsKno2xDmUnCEYN3 y7Zetdvu63Z3sCVpar3WktPlUTdgkwNjYzldXprVwa4w7z3m2irG9vIN1Oy2JtzVb20p SYjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6/C6I0i87/WZnXIrmrosa90/eAl9LYlEh8C0iWOtu10=; b=x0k1vkjagSNG/JMX0ojNPCNOXAhTccjweLC8MZ2SPw76kQZsocQZvfqMWUEuiWsqrI 5um7d0HxV09y7F/EidPKoZy8ujg5gRPLbHkWPCpqonSLFJKadh8XYrJ28N7LwSxn4oVI IOkEYWjG/Jsw982/irH8BincPjVT/1Mp5mwxfbNyiC5wAn8+M+f0C1O4iglFv+47ES2f tiZdlvOLfIp+1cTXMLZZNpbpmNUOozaSxVdp/eHwDVxcJsYSF63kMa7fzFptepnsGXSH q/aj5uoULwMiQjAa/RSzsgwVa7TGsJOfxZ/zt/zDD7imBMs+PjBBvMGv0JF2e20rcXil Y1aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dQKartIz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si7513163eje.52.2019.11.26.13.23.57; Tue, 26 Nov 2019 13:24:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dQKartIz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726033AbfKZVXA (ORCPT + 99 others); Tue, 26 Nov 2019 16:23:00 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:41007 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbfKZVXA (ORCPT ); Tue, 26 Nov 2019 16:23:00 -0500 Received: by mail-pf1-f194.google.com with SMTP id s18so1239100pfd.8 for ; Tue, 26 Nov 2019 13:22:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6/C6I0i87/WZnXIrmrosa90/eAl9LYlEh8C0iWOtu10=; b=dQKartIzq9lcDOeMZSrCdPu+Yi2YLj6S1/i5r+r3Z3CmlM3Um0R+5E9S+TUfrXu+IQ Njvy16TFycCN2Bh5R1dcR4Hu93XeMjXF0VyoxFEt5gEpQ7HXeZrUO+h4iKEDsIvcGugV Afm6BC1zXhozTaIh+c5Eb2Gn/YAgy55BSz5tG3LrqgTB+3W3cxsbssoW73Zh7sV9hqsV 65ueX0gbdQbTJhBab7QyqVvHii+DDpSbz1VJ7qzSkgBN1/DJnTdiCAI95mVbKqwkFwrx khfrKjsTzH8jCPIiqYbZn1TkrfArjIhixC5u4eHN/vi40i1cqd3Gvsr5yA/3npLif6y+ 9e3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6/C6I0i87/WZnXIrmrosa90/eAl9LYlEh8C0iWOtu10=; b=X1fiYNbVNseH0apdkw82q5SBjAWKchdv533XXXzrZAb7ri7LE1xVHcKejpaZgeEjC1 ERscFJrqK47DmHkNGtZojb9di4rB5/IsuD40zeodGbbIC8cPePmjU93fFgcF8WvOB5qI tQp5CRefuofT4AZYGYgSFck8qETYOkejwWbnj4QkSBkLMLMyxbEfA4UF/nog/FzL4Dzn /ml2WnoBhwIMOfHH+enHxiwLE8YiDcQlHrNRIm0heowILuxV115ivv4A+2Ghn0Kiat6P H4dxgJB7zutOLyou3xcPi+QnUP0TUVnXQoWTJGtTIYZtx4BZq33tHMa0CKu8qjuypOHq ehQQ== X-Gm-Message-State: APjAAAVeMwos4SV1SOu2omM0JWlCLblTmzTawdOOPieYh2R3sIO7V2jF 9G59oh4bDN6gJ+caSoQ4NICeEZvdNp2paUH5y74c+w== X-Received: by 2002:a65:590f:: with SMTP id f15mr560009pgu.381.1574803378796; Tue, 26 Nov 2019 13:22:58 -0800 (PST) MIME-Version: 1.0 References: <20191126201226.51857-1-natechancellor@gmail.com> In-Reply-To: <20191126201226.51857-1-natechancellor@gmail.com> From: Nick Desaulniers Date: Tue, 26 Nov 2019 13:22:47 -0800 Message-ID: Subject: Re: [PATCH] netfilter: nf_flow_table_offload: Don't use offset uninitialized in flow_offload_port_{d,s}nat To: Nathan Chancellor Cc: Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, Network Development , LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 26, 2019 at 12:13 PM Nathan Chancellor wrote: > > Clang warns (trimmed the second warning for brevity): > > ../net/netfilter/nf_flow_table_offload.c:342:2: warning: variable > 'offset' is used uninitialized whenever switch default is taken > [-Wsometimes-uninitialized] > default: > ^~~~~~~ > ../net/netfilter/nf_flow_table_offload.c:346:57: note: uninitialized use > occurs here > flow_offload_mangle(entry, flow_offload_l4proto(flow), offset, > ^~~~~~ > ../net/netfilter/nf_flow_table_offload.c:331:12: note: initialize the > variable 'offset' to silence this warning > u32 offset; > ^ > = 0 > > Match what was done in the flow_offload_ipv{4,6}_{d,s}nat functions and > just return in the default case, since port would also be uninitialized. Thanks for the patch. I have a report of this from kernelci bot, would you mind crediting it: Reported-by: kernelci.org bot Looks like `port` is uninitialized (prior to your patch), too. Reviewed-by: Nick Desaulniers These two functions look identical except for the mask. The maintainers should consider reusing more code between them and passing in the mask. > > Fixes: c29f74e0df7a ("netfilter: nf_flow_table: hardware offload support") > Link: https://github.com/ClangBuiltLinux/linux/issues/780 > Signed-off-by: Nathan Chancellor > --- > net/netfilter/nf_flow_table_offload.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c > index c54c9a6cc981..a77a6e1cfd64 100644 > --- a/net/netfilter/nf_flow_table_offload.c > +++ b/net/netfilter/nf_flow_table_offload.c > @@ -340,7 +340,7 @@ static void flow_offload_port_snat(struct net *net, > offset = 0; /* offsetof(struct tcphdr, dest); */ > break; > default: > - break; > + return; > } > > flow_offload_mangle(entry, flow_offload_l4proto(flow), offset, > @@ -367,7 +367,7 @@ static void flow_offload_port_dnat(struct net *net, > offset = 0; /* offsetof(struct tcphdr, dest); */ > break; > default: > - break; > + return; > } > > flow_offload_mangle(entry, flow_offload_l4proto(flow), offset, > -- > 2.24.0 > > -- > You received this message because you are subscribed to the Google Groups "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/20191126201226.51857-1-natechancellor%40gmail.com. -- Thanks, ~Nick Desaulniers