Received: by 2002:a05:7412:bc1a:b0:d7:7d3a:4fe2 with SMTP id ki26csp1337516rdb; Mon, 21 Aug 2023 05:03:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IES0p1Ug1/uZKm/j1wcWYdQphUEdV3+f1XLll2kkV5AtC/+vB8338JgfLPBjl2RIv/VK95V X-Received: by 2002:a17:906:311b:b0:99d:6b79:6ed1 with SMTP id 27-20020a170906311b00b0099d6b796ed1mr4643722ejx.55.1692619425203; Mon, 21 Aug 2023 05:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692619425; cv=none; d=google.com; s=arc-20160816; b=X3Ps0sE35/X+jr1roxpoDN6bja3WPqhq0fuWtOJuwQECf1CZZ5/NWAz1x8oF141SaE DEA1LiW+6H5NG26+F4UFsklW+anlEh6Y8TLWUkcIh2bLUnXnb/Stfvm+xl+24OK3jhRo sCOZGolc8+XSxYtgo1DeyrZnfZ7+tAWoPnrGSVubgO05DMVJnBSa4U71EbTcmpWI5Ae0 F032IJGHyB0pouROTMdZlogIKtNj/8Xgjm/cLX2oaU06ViOCj/PC8CExHJRTrL3+T4Dn FtsABCUmZVKlU4+3LR4TeMaFy3+71nHK4VvuyJ18NJmIwArTznHne6dYdKYJJBbgsFLY v7VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=k+rfF2OSr4ciWIPKfZpIAqb+AjtDqKOf+psdw63lnPc=; fh=j0N/5hk+t6FPcFiM45b9HQZMUIflFeSlZ5AgepgjhDo=; b=ZAXhFeXWyCTvjSMzB8Q6Nyv7ofSkwdP2S53SfOSXkItHgaUPZEqb7EMlhKVJNn6wxJ YasMS7Y47+Mlhdq0eLhxJnM9DCoKmgdod3iSr3Oau1xQ2Ui733XmZIhca8KGxWlywR8s uR96mb5rmqLIE80w/mwA3UWNYQEO3AX2hYmhcrZAkbMOZmyhlndYNYA91JQZLoMgvdne t7jEF8Z99q5VMNavveQU1d3QHfBRuSmctdDLH8zddq0OlGWX9UTQtO3JTCSRiHY1936a dVpDaOb6ahC/t7G85OtetzESTUYXIxUJVjRO0u/GmPLSsUU52qT4vGUtNFfiCARoWSjh iUFQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x23-20020a170906441700b0099caf27e61fsi5282864ejo.244.2023.08.21.05.03.20; Mon, 21 Aug 2023 05:03:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233930AbjHUIQm (ORCPT + 99 others); Mon, 21 Aug 2023 04:16:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbjHUIQl (ORCPT ); Mon, 21 Aug 2023 04:16:41 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9939993 for ; Mon, 21 Aug 2023 01:16:39 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-113-9_BOF_yAPvOdY0vZpb4dPw-1; Mon, 21 Aug 2023 09:16:28 +0100 X-MC-Unique: 9_BOF_yAPvOdY0vZpb4dPw-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 21 Aug 2023 09:16:17 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Mon, 21 Aug 2023 09:16:17 +0100 From: David Laight To: 'Alejandro Colomar' , Kees Cook , "Gustavo A. R. Silva" CC: LKML Subject: RE: struct_size() using sizeof() vs offsetof() Thread-Topic: struct_size() using sizeof() vs offsetof() Thread-Index: AQHZ0KEzXPZ5QWstfUGUK20udA0j8K/0arpg Date: Mon, 21 Aug 2023 08:16:17 +0000 Message-ID: <55bb7e4f633340db9a9c013b91afedd6@AcuMS.aculab.com> References: <74e8cf91-d095-33e3-c548-34d80b691089@kernel.org> In-Reply-To: <74e8cf91-d095-33e3-c548-34d80b691089@kernel.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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 RnJvbTogQWxlamFuZHJvIENvbG9t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