Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5486863pxv; Wed, 28 Jul 2021 11:56:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq5OgD7hA/FDQSUaTyYzvYTKXSDuOXJPkc/GqrvjFrSO6isdlEAXWVwc8ksKnsP4eDf9ph X-Received: by 2002:a05:6402:1118:: with SMTP id u24mr1501791edv.229.1627498611280; Wed, 28 Jul 2021 11:56:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627498611; cv=none; d=google.com; s=arc-20160816; b=RHvzh/jddsiA0xGBl5B27dgWFQrPZfU0Su7ypAixdk22uviS5YKlH5+MZJfG3yE+57 ZCExdSW/SeK+cstOBkqoDjrn2Xey0S2mqdlsUB8FS8RQqBvASO7/MD2ff+26y18npOWn +iCp+Nf0uFyEBb+v3ZmWMTHlm7J3Ch2Bl+fhc7A4L3hl1RaiIVq0COTEBGrUh2IJJcuZ sULbkvJjdFIryFgkyk1UM1NqwsZp3tb0cFiAO0PYpKKNxaCaVOFtG49OhOhtCdxNoprL YFIUAtdJ7GxF29blw085NkPfyQJv3cKzFvzqQutcJWD7M54cT7MXk05nlMX9BHQ6a/Md PFtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:references :in-reply-to:mime-version:dkim-signature; bh=pg9Oc8FexJdwg++WGxFIyzfbO7HtZXQu4+lhfbZZJSA=; b=Skm+/8VdgjLz69mSoEosX1lweQ0IooHz+2tYWTPYpo6wAuDztc16lTti+5xazfP18q QOfGXT60Si5lslQCb+uGPzYtKrIXzragEuFbJ69s5Zv2Y6qhlyqzkYbaH6jv7LLHHpX7 SAhudtWgfGaIGuKmf62EGMsPFDfGXAZN6IV2Gtb9sf6RNVOCAaiR5lZsl1cYX0nAIWJi z944D9IWpO92vUfesABa/nz+4Lv96/rdlgLOWUscJn7WsHaMviQx4gdfu+7mbC5ojxUp 8ci5zE4SIdOIjGG8c8QeGg5oSS2wNk8mn2sETiwkLyb/n+WgTbtWc85HhVg+RSxlh23M U0Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SmUnU1tP; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id my47si564813ejc.645.2021.07.28.11.56.22; Wed, 28 Jul 2021 11:56:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SmUnU1tP; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbhG1S4H (ORCPT + 99 others); Wed, 28 Jul 2021 14:56:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230209AbhG1S4E (ORCPT ); Wed, 28 Jul 2021 14:56:04 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08A87C061757; Wed, 28 Jul 2021 11:56:00 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id o7so3388806ilh.11; Wed, 28 Jul 2021 11:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pg9Oc8FexJdwg++WGxFIyzfbO7HtZXQu4+lhfbZZJSA=; b=SmUnU1tPVN9i/9tG/rMNoyq8GC2Ca9VXG2fndr5Q7lbUN7q2OvL7b3A8tyIlk4aRZO 8CxuepNlFVgtbqoM3ADQ3U0+DYSTh4XKY1ShBRwP2xptYX4NzEjxotT52leIbd5xNRXk 9vOonTxqSQqQW8naRs/ta+UU9thoYqHRLs8DxUAFrNPA0djreJxetA6MW8BtY4WeIUIW dOTRz3L5cqS+wmNpuKdYDrs8Y7JxgzfS82zfkL2T7J9e0mh4UxOrd8m2b0kxlUw+Ng/I ath2ZAyFnQXTEeGUJcV4oPxvcRcr2dsP1ecLOrYEwKb4egINVvb+Xoa2A3ZtaP1NLjlz iCpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pg9Oc8FexJdwg++WGxFIyzfbO7HtZXQu4+lhfbZZJSA=; b=E7TeiL/uFCWN5lGIP/AaziPS8B0m19tsCXl7RrDPQSxzSx0UfqDNLzptaKx7fk8Ltr mhb8vqEguHEzKgwDle028s8DV+flYOX7rU969qshszJeM43LsdSpMSb1woeWy7Id5Rm9 ThU7eS63gtd30QcJJy0yDs3sX1FTPJ7buEpjwvRgpJKRYvK9G/bdu81AuppMnUY7Ae35 AzIMpw3ZT2m3v3liSfT41PFaOYxanb49LSWr/BCKvfq82/dJwqjSs9JCweYFHlQDKDVB 6+s2t9Du84F/HwxYXC704+tJroK5NH7H1uprQfRNGHpBcXo1sZhg/mxkzcmrDqb0Bsx0 0Nzg== X-Gm-Message-State: AOAM533k8VQmDQY3gRxNKQsVYfO3QRn6irDoCu/y6na1CvrPKQXsvtQ3 PP77J0UluTIVPtcQ0oef+RfXA/sfRcM1ALJ8RKU= X-Received: by 2002:a05:6e02:dcd:: with SMTP id l13mr851205ilj.300.1627498559514; Wed, 28 Jul 2021 11:55:59 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6e04:29b:0:0:0:0 with HTTP; Wed, 28 Jul 2021 11:55:58 -0700 (PDT) In-Reply-To: <20210727205855.411487-16-keescook@chromium.org> References: <20210727205855.411487-1-keescook@chromium.org> <20210727205855.411487-16-keescook@chromium.org> From: Stanislav Yakovlev Date: Wed, 28 Jul 2021 22:55:58 +0400 Message-ID: Subject: Re: [PATCH 15/64] ipw2x00: Use struct_group() for memcpy() region To: Kees Cook Cc: linux-hardening@vger.kernel.org, "Gustavo A. R. Silva" , Keith Packard , Greg Kroah-Hartman , 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 28/07/2021, Kees Cook wrote: > In preparation for FORTIFY_SOURCE performing compile-time and run-time > field array bounds checking for memcpy(), memmove(), and memset(), > avoid intentionally writing across neighboring fields. > > Use struct_group() in struct libipw_qos_information_element around > members qui, qui_type, qui_subtype, version, and ac_info, 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 qui. > > "pahole" shows no size nor member offset changes to struct > libipw_qos_information_element. > > Additionally corrects the size in libipw_read_qos_param_element() as > it was testing the wrong structure size (it should have been struct > libipw_qos_information_element, not struct libipw_qos_parameter_info). > > Signed-off-by: Kees Cook > --- > drivers/net/wireless/intel/ipw2x00/libipw.h | 12 +++++++----- > drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 8 ++++---- > 2 files changed, 11 insertions(+), 9 deletions(-) > Acked-by: Stanislav Yakovlev Looks fine, thanks! Stanislav.