From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DF8470 for ; Wed, 28 Jul 2021 05:45:39 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5EAC060F93; Wed, 28 Jul 2021 05:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627451139; bh=iRPIkA9wCneiiPcbFTtaQRP1uYFSznhLeZtrCj67jCs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cSi5Yn73Q7vWLdkilrflKgNOm7mNY5dQqgNjN+qepVVuYUWrI0aHzBMp1F6Q0epj9 ZMRABIZgA+udyB+hnoMPHnAJxchAq9ks+jQbdEnkCRvARKi62oxT1yu+FxUgwo1NKi BkptoOs2eYMnU4S84hmk6GAERU1CRR9+P4HQ4kPY= Date: Wed, 28 Jul 2021 07:45:36 +0200 From: Greg Kroah-Hartman To: Kees Cook Cc: linux-hardening@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Andrew Morton , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-staging@lists.linux.dev, linux-block@vger.kernel.org, linux-kbuild@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH 07/64] staging: rtl8192e: Use struct_group() for memcpy() region Message-ID: References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-8-keescook@chromium.org> Precedence: bulk X-Mailing-List: linux-staging@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210727205855.411487-8-keescook@chromium.org> On Tue, Jul 27, 2021 at 01:57:58PM -0700, Kees Cook wrote: > In preparation for FORTIFY_SOURCE performing compile-time and run-time > field bounds checking for memcpy(), memmove(), and memset(), avoid > intentionally writing across neighboring fields. > > Use struct_group() around members addr1, addr2, and addr3 in struct > rtllib_hdr_4addr, and members qui, qui_type, qui_subtype, version, > and ac_info in struct rtllib_qos_information_element, so they can be > referenced together. This will allow memcpy() and sizeof() to more easily > reason about sizes, improve readability, and avoid future warnings about > writing beyond the end of addr1 and qui. > > "pahole" shows no size nor member offset changes to struct > rtllib_hdr_4addr nor struct rtllib_qos_information_element. "objdump -d" > shows no meaningful object code changes (i.e. only source line number > induced differences and optimizations). > > Signed-off-by: Kees Cook > --- > drivers/staging/rtl8192e/rtllib.h | 20 ++++++++++++-------- > drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 3 ++- > drivers/staging/rtl8192e/rtllib_rx.c | 8 ++++---- > 3 files changed, 18 insertions(+), 13 deletions(-) Acked-by: Greg Kroah-Hartman