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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBAB3C433ED for ; Mon, 19 Apr 2021 08:06:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1A2761165 for ; Mon, 19 Apr 2021 08:06:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238140AbhDSIGp convert rfc822-to-8bit (ORCPT ); Mon, 19 Apr 2021 04:06:45 -0400 Received: from mail.netfilter.org ([217.70.188.207]:35960 "EHLO mail.netfilter.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229848AbhDSIGn (ORCPT ); Mon, 19 Apr 2021 04:06:43 -0400 Received: from us.es (unknown [90.77.255.23]) by mail.netfilter.org (Postfix) with ESMTPSA id C36A063E49; Mon, 19 Apr 2021 10:05:42 +0200 (CEST) Date: Mon, 19 Apr 2021 10:06:10 +0200 From: Pablo Neira Ayuso To: Valdis =?utf-8?Q?Kl=C4=93tnieks?= Cc: Felix Fietkau , "David S. Miller" , Christoph Hellwig , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: drivers/net/ethernet/mediatek/mtk_ppe_offload.c - suspicious code? Message-ID: <20210419080610.GA24040@salvia> References: <526789.1618794132@turing-police> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <526789.1618794132@turing-police> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, Apr 18, 2021 at 09:02:12PM -0400, Valdis Klētnieks wrote: > While doing some code auditing for -Woverride_init, I spotted some questionable code > > commit 502e84e2382d92654a2ecbc52cdbdb5a11cdcec7 > Author: Felix Fietkau > Date: Wed Mar 24 02:30:54 2021 +0100 > > net: ethernet: mtk_eth_soc: add flow offloading support > > In drivers/net/ethernet/mediatek/mtk_ppe_offload.c: > > +static const struct rhashtable_params mtk_flow_ht_params = { > + .head_offset = offsetof(struct mtk_flow_entry, node), > + .head_offset = offsetof(struct mtk_flow_entry, cookie), > + .key_len = sizeof(unsigned long), > + .automatic_shrinking = true, > +}; > > What's intended for head_offset here? It's a bug, there's a fix here: https://www.spinics.net/lists/netdev/msg736368.html