Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2300955pxb; Mon, 19 Apr 2021 02:18:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKpaxvgrrbfYJ7PVD5/VzbdB/zKcAuVvd2vB/+EtKLcgJ8SMAqKvKdDuOhCJ7ih8M/D6gB X-Received: by 2002:a63:3245:: with SMTP id y66mr11135991pgy.435.1618823922137; Mon, 19 Apr 2021 02:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618823922; cv=none; d=google.com; s=arc-20160816; b=RSvyxxQSR+7fHlnFWNcfuzqjj3U1u3bkcUF6wdUIEwjr8E1Mt4CGQBHaaK7hni2qm4 JzQIRa8jdw1YFdY7mBzuKlieDGicwZOGeVZ+S3g4ep7m+ig4hepC8om3RTToaEwyKSfm X4Q6dDzk7duVd/t5b53M8UVNG/aSmKrrYAa6hapsysLnSHcOGEhWrJO+xSGzkGh3LbPp zVCr7mhKlIRI8ZRuIzS3U0iNqJrde4uchrUMr7a12A2w7XnMPCmbPD2brYvu0SFxmyWy muy1fxuSs5zd9C2jiroTQJ/YzsvmGSfA5GKlXne6cWRmSe/KibcY9TtBGcR7CXHIGpK9 56xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=V4MPeanvk5pqVLABF3Aw1YTZCmp0skF2rCm+t0LTxF0=; b=tQax4Nux4pmGTKjg7rNsmgwWO4Nt8054D/wz0240fNL3xbpebbXp86QhVaeDOkDuQM 7grQGc6pyomf5tVYJKCxaRGcIOcRp/4Vkug7cvU02UGyzHj5uLCx77tBwpJ/Gf7UwJAb cLEgVJ/VV3LeMNNBfDNODgxWBZLsTA+QjqlssYC/TGGl9jNwrx1Kk9KGd+KVdj/kNMHk WpSIqcjhGRXQR9+vb1n1/sdpdCgO5D+GfNOjSF8fGh5A0El993YlEfocdx/9DLLo2bEg shOntPZySKR9c6wsLp14jfx8J7M+ZZyHMsOliwHbk8QrQdrkTvAIaKqgvzBrBk+YhhJn J4VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b15si18499855pgw.34.2021.04.19.02.18.30; Mon, 19 Apr 2021 02:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238128AbhDSIGo convert rfc822-to-8bit (ORCPT + 99 others); Mon, 19 Apr 2021 04:06:44 -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: linux-kernel@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