Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4001871ioa; Tue, 26 Apr 2022 14:32:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlZ0xVzPwjNX5jOD1VCq59wHt6fZvWfmc0EfAa3/ojTcfO7TpK5/nbkQnGEF12kQuqHLbK X-Received: by 2002:aa7:d9d6:0:b0:425:dafc:2fc6 with SMTP id v22-20020aa7d9d6000000b00425dafc2fc6mr14772860eds.340.1651008777162; Tue, 26 Apr 2022 14:32:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651008777; cv=none; d=google.com; s=arc-20160816; b=wMc97XWnjp4P5E5NKW9fFi0uh+WOrIEfxx5JNVHY5dQnXiV+2rUiGpJiuwaEBxUUfq oHfftgnhE5zC7iqm7B6G6qAxogSH8LCciD19JPg+aSaU51mEZuRINaHdJUsSfZrM4v3V 4BpC9+rcaOl/KqENPkOv/u0weTer+TuRXJOEGNA8PVnS3/ljS0nUScyUTkmrc9/qXBzO 64+9B7td/CkeaYptRuuEPtQ5L19oJe/JMAT0mZDbHxhtqAs5eezf/ldi/dXlQbvAqp1y e2RLb19i3y4OlBU+EiokC9o0Q/2ikxS0uv+QtyjxNAWh7Qd/hCtlkkYACNUF57wwlDe0 DagQ== 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=jR4aPO1c57ke9GJ70LSbYMeXxye0hNsvTAgaT66JhEE=; b=hmkWjujHXvAUhbgMSHrnYvlHH52FLVj2vve5DoY4ZqCkRnAFgFd6cWBkYyQeJY48s7 W00/K3zjMrrfcCJLUMcp7hz1XzaHwxPYB8pXB7D50D47aUuWQCTj3Qed2xz51poQ/Exe zO6xR1cjbtan4GiXFyOVrCfS3MXybOpbe4gx5nPnaD1WOTV1IySB30Z3qAXVxg2zwm7Y mOvlFtFT3FVCwwsv/sSvrY+vIo82moZJBBynT27BTQTWfCPayp2c9nCamRAHQ/ZhYafn RihaozIWsjo8jP9EPGynsIEKiPs7k8IwQGIBZsDTjYc0nnKyZhxgOmbEJpg36tfrkeWb E9Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2KwYN0CJ; 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 m16-20020a170906161000b006f39d4e9362si5319308ejd.632.2022.04.26.14.32.33; Tue, 26 Apr 2022 14:32:57 -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=2KwYN0CJ; 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 S1346880AbiDZIuw (ORCPT + 99 others); Tue, 26 Apr 2022 04:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345823AbiDZIje (ORCPT ); Tue, 26 Apr 2022 04:39:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5AC178FF3; Tue, 26 Apr 2022 01:31:49 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 81FE2618A0; Tue, 26 Apr 2022 08:31:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91D09C385AC; Tue, 26 Apr 2022 08:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650961908; bh=kulICPpZkaG7KXC0Zq/7qmjdwSorCIwP4RaDDU/n3t4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2KwYN0CJqtu/3iIwD9tN3CDQ0ejaXRfVRqiooXava+W1aocpsd8Ca7rz1fNmhi25l nzxe+p5y6elqZ5zf3OCavABB1zk6r97dMBgkj0tH9q5XMqzUzvDeL8lTKGcxFzk/Tv qe+4yII+inSWDmNL8x/QSbnbUp6bgoF8CHMP7cR8= 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.10 01/86] etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overead Date: Tue, 26 Apr 2022 10:20:29 +0200 Message-Id: <20220426081741.247427711@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081741.202366502@linuxfoundation.org> References: <20220426081741.202366502@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore 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 @@ -352,8 +352,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);