Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3565450ioa; Tue, 26 Apr 2022 06:12:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0J0VNxJlRBFNGOQhnd+XzUtL2hqD2zspr7bwZq/4XyYksJxmTMP3mQh+/IQj6b7596pB1 X-Received: by 2002:a05:6402:2999:b0:418:eb22:64f9 with SMTP id eq25-20020a056402299900b00418eb2264f9mr24253745edb.391.1650978739901; Tue, 26 Apr 2022 06:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650978739; cv=none; d=google.com; s=arc-20160816; b=L20vs1E59MAK1fJwvKAT+Q/W25vJOtuwPW2nerNTmL79lmOOIxZVJ04ir9TjTKC9uu dX5BflvR0Da4ZOULCVaeQzAvo7M3S6/ilN1bnw32XRu6xH39belNYvAZfKsk8HdNKAQm wP+HG07zpJ2MoBtQrZkKWv++2vOMTmON+HOWX4AmsjhwR1tHUt9WcmrQbO71ahFsMv+u CDB9RGVUwsDaOVtnpSXzzwlEOFOXsCky4kstWtgc02Hmqd8/m5fLLAu7Cx9sCRG53g1b 5zRTaUxF++J4aK5wYsN1GhOySWBrEJlH6s1/U3msgaRcG5W0CF5DWKhr1Q0/zKg+PTGz gq3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1HmVpVwLlo3ES6Qbj2KnndLGYdYJm/se9Re80HzGrQw=; b=dEZ1qiZMQS7WC6HLf7LEJp3DsZxHtpgAVv4+QzTf7RBK5fDKTGAb9Pf6q5pyO11sz8 iXBG5R6MUUTl2pZEhMTtRxwwVt/XYiCxDaKxYodzG4SMm1wLltPJoG5uQThGa9r8tJSE kK6jDLrEiNY2kCnmxOL3vxTBRgEG7ybnG+pWWv6cC3xwDK+sv9H8fGQ+F2kVJhpmzHKB 4wAmBF4J7ToHm/Q8j5UwIoy5bg1MSae6Z/DGh3i7zQ4531b8RWzlIWZy49Iv5YeA/ktZ 8oB5HQwgQbZGMWvlIWPXRGE/0Tv8+sxDDnNdY99ngmXyLmg4G8iZF6aBtpgor0PvWvn+ 3DYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=edtD9RsJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a170906440700b006e8a20ff40bsi15384872ejo.303.2022.04.26.06.11.55; Tue, 26 Apr 2022 06:12:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=edtD9RsJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234803AbiDZJQl (ORCPT + 99 others); Tue, 26 Apr 2022 05:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346073AbiDZItu (ORCPT ); Tue, 26 Apr 2022 04:49:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4DDCBB921; Tue, 26 Apr 2022 01:37:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EABDDB81D19; Tue, 26 Apr 2022 08:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58791C385A0; Tue, 26 Apr 2022 08:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650962269; bh=qMpCqUCdhyMR/21WSKQ0+DrkxS6S4vYxyQeR11WMz/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=edtD9RsJV3/srcc+ccAchx3L59gpzXCP/VMZ0nP15Emz7Y3k7byp7Nbpb0/8Pvzur SaNN0kb6xjmAmJ1e+bYyoCP5wwlswrZe3AjTyJYX4PXXKaGqHK6EFhN8KSwTPCxT51 ZfjEmAiUd9/zTqS4aDKjvUW4QGg0w4l1nWYyiFNA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Kleine-Budde , Jakub Kicinski , "David S. Miller" , netdev@vger.kernel.org, Kees Cook , Khem Raj Subject: [PATCH 5.15 008/124] etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overead Date: Tue, 26 Apr 2022 10:20:09 +0200 Message-Id: <20220426081747.533483888@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081747.286685339@linuxfoundation.org> References: <20220426081747.286685339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook commit 2618a0dae09ef37728dab89ff60418cbe25ae6bd upstream. With GCC 12, -Wstringop-overread was warning about an implicit cast from char[6] to char[8]. However, the extra 2 bytes are always thrown away, alignment doesn't matter, and the risk of hitting the edge of unallocated memory has been accepted, so this prototype can just be converted to a regular char *. Silences: net/core/dev.c: In function ‘bpf_prog_run_generic_xdp’: net/core/dev.c:4618:21: warning: ‘ether_addr_equal_64bits’ reading 8 bytes from a region of size 6 [-Wstringop-overread] 4618 | orig_host = ether_addr_equal_64bits(eth->h_dest, > skb->dev->dev_addr); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ net/core/dev.c:4618:21: note: referencing argument 1 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’} net/core/dev.c:4618:21: note: referencing argument 2 of type ‘const u8[8]’ {aka ‘const unsigned char[8]’} In file included from net/core/dev.c:91: include/linux/etherdevice.h:375:20: note: in a call to function ‘ether_addr_equal_64bits’ 375 | static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], | ^~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Marc Kleine-Budde Tested-by: Marc Kleine-Budde Link: https://lore.kernel.org/netdev/20220212090811.uuzk6d76agw2vv73@pengutronix.de Cc: Jakub Kicinski Cc: "David S. Miller" Cc: netdev@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: David S. Miller Cc: Khem Raj Signed-off-by: Greg Kroah-Hartman --- include/linux/etherdevice.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h @@ -127,7 +127,7 @@ static inline bool is_multicast_ether_ad #endif } -static inline bool is_multicast_ether_addr_64bits(const u8 addr[6+2]) +static inline bool is_multicast_ether_addr_64bits(const u8 *addr) { #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 #ifdef __BIG_ENDIAN @@ -364,8 +364,7 @@ static inline bool ether_addr_equal(cons * Please note that alignment of addr1 & addr2 are only guaranteed to be 16 bits. */ -static inline bool ether_addr_equal_64bits(const u8 addr1[6+2], - const u8 addr2[6+2]) +static inline bool ether_addr_equal_64bits(const u8 *addr1, const u8 *addr2) { #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 u64 fold = (*(const u64 *)addr1) ^ (*(const u64 *)addr2);