Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4464646ioa; Wed, 27 Apr 2022 04:35:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5T849T1sHUJ845Fh8vgmmX5mXs9AQs88viNpX4kHddweA8ARGA9DQ5EkW61t+pIHW+nOL X-Received: by 2002:a63:79ce:0:b0:3a9:efa0:17d with SMTP id u197-20020a6379ce000000b003a9efa0017dmr23845773pgc.170.1651059300177; Wed, 27 Apr 2022 04:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651059300; cv=none; d=google.com; s=arc-20160816; b=x2eZ7t5Cg2Sq2TjfWuybLcqyZLVG1jF0A2LVGPjOrsr5OJpaHSa6eVG/jJCulTKXyI jymlWr9Y5x8hmmb/32L6gmW2YM+7MExcUMCewB0SpYOTFr782d8UrcrgVGw/wU8K4hMO 9XFQL0GFDA+moqhxhXlLtPUlhxCVb+fVND2hct/EYbPh/adLQydSNArkxUd8JppiRc/1 uDS2Gl4qUlIu55XHaYWELhuYvWKKct+mSnMWQleIA5eQMK4o3IYQWrKnt7sGbAacPG8d CUVpXPnGcYqfTgDayqZoSqUEL++WUnh215DP9I5cRTbTPk4zFcLuXytyYVMnMoiTRK0O I9nQ== 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=S8laHjkmddlSA6IfK2JjBBqpxeGnqLsXo981ZxEVFu8=; b=UaXAqyNmeQwvHHUnZZN8Z+STYy3veuQ1aRlTmGbBr/CFkpIxDXMizIMGnwTNBzMWUn V8wgznduCL6cxqPP/GM8Lt7nljxBZtYVWY3oon19xVOq2WRosGwYXtzTa4exrPSWMh2G vJ5gErg91q14Q0EyFWjYOfUNUJg88w0GEVHsd+hcbcowprMw7PuqwHi1+ZMMlJz7fGsk ogrMRb1CMxLbGF/0CgWaVRJImlH3zE8nPHppE3T4K8dKlDhCFoYQQhH9TX7MJklIDW9H jhBvMNRmXino+NfPV3RZgjkorbWu1qWOiLS85ih5XHUpYhug/9GgjYASZn56+Kasa4iP vMcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EsQBKkLr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k22-20020aa788d6000000b0050c2e35dfe6si1146021pff.59.2022.04.27.04.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:35:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EsQBKkLr; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A493E494093; Wed, 27 Apr 2022 03:24:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbiDZIlN (ORCPT + 99 others); Tue, 26 Apr 2022 04:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345106AbiDZIeF (ORCPT ); Tue, 26 Apr 2022 04:34:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 965476D95E; Tue, 26 Apr 2022 01:26:05 -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 04426B81CED; Tue, 26 Apr 2022 08:26:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 529B7C385A0; Tue, 26 Apr 2022 08:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650961562; bh=dkv8QN0gQVSZtZdSD5Khr9zcrthMVra0NtgbZ2JmCHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EsQBKkLrJOFzoLEamucKtxOZWK2vchdtXJ4MlwDS4YC0aubuy6HO5F1rbcjQM6/Bz HBxKUMCtqReZFLBEIR+ej5uCE8S4RshMvnMFRe6xkjr8dinQd2W2je5l6EEZG2+bhn Jc167B3vV/ywmZHrQSl36LqB8VKL+xmG6bfPkaLs= 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 4.19 01/53] etherdevice: Adjust ether_addr* prototypes to silence -Wstringop-overead Date: Tue, 26 Apr 2022 10:20:41 +0200 Message-Id: <20220426081735.697201013@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220426081735.651926456@linuxfoundation.org> References: <20220426081735.651926456@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=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable 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 @@ -130,7 +130,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 @@ -344,8 +344,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);