From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, T_DKIMWL_WL_HIGH autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18C96C46477 for ; Tue, 11 Jun 2019 20:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DAAA22086A for ; Tue, 11 Jun 2019 20:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560286115; bh=y33lrlkQja7eoIovWsePDjdEdIHZ/RJoRj29PafhqOI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=TrQze1Qf5MniOE/vIwycPTi7gSLI0SIOYCrXnic+OStWqEHG10Uvl6doTaRgbVY+G deVLlvtbYWd4QjS9ax/q9rdaDM/2+0Lbk+NhQBfJkh/oG0hcUw7/McQGAL9ZxnY3U4 jUkFh0coQF4V0W7RB0O+K7+XOkUvmtwwYdNlVS3g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406110AbfFKUse (ORCPT ); Tue, 11 Jun 2019 16:48:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:52324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405881AbfFKUse (ORCPT ); Tue, 11 Jun 2019 16:48:34 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7CE6320684; Tue, 11 Jun 2019 20:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560286113; bh=y33lrlkQja7eoIovWsePDjdEdIHZ/RJoRj29PafhqOI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UgyruavCsSZLLvbVGn/8Url9hdMFqD/vc6cS2xvCxVAaLGSpqRyO7wgSl3uYSlnrC 3+fJjYU9x+kvkKn62ONAnZk5QMPYKtIt9RU5V2bIySebdJX4pNazzbre4oO5OlK2mG 81xtH5C+HAjNqK8Itw5roVmiKtRcfGnYRZlw+kVk= Date: Tue, 11 Jun 2019 13:48:31 -0700 From: Andrew Morton To: Shyam Saini Cc: kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, keescook@chromium.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, netdev@vger.kernel.org, linux-ext4@vger.kernel.org, devel@lists.orangefs.org, linux-mm@kvack.org, linux-sctp@vger.kernel.org, bpf@vger.kernel.org, kvm@vger.kernel.org, mayhs11saini@gmail.com, Alexey Dobriyan Subject: Re: [PATCH V2] include: linux: Regularise the use of FIELD_SIZEOF macro Message-Id: <20190611134831.a60c11f4b691d14d04a87e29@linux-foundation.org> In-Reply-To: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> References: <20190611193836.2772-1-shyam.saini@amarulasolutions.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Wed, 12 Jun 2019 01:08:36 +0530 Shyam Saini wrote: > Currently, there are 3 different macros, namely sizeof_field, SIZEOF_FIELD > and FIELD_SIZEOF which are used to calculate the size of a member of > structure, so to bring uniformity in entire kernel source tree lets use > FIELD_SIZEOF and replace all occurrences of other two macros with this. > > For this purpose, redefine FIELD_SIZEOF in include/linux/stddef.h and > tools/testing/selftests/bpf/bpf_util.h and remove its defination from > include/linux/kernel.h > > In favour of FIELD_SIZEOF, this patch also deprecates other two similar > macros sizeof_field and SIZEOF_FIELD. > > For code compatibility reason, retain sizeof_field macro as a wrapper macro > to FIELD_SIZEOF As Alexey has pointed out, C structs and unions don't have fields - they have members. So this is an opportunity to switch everything to a new member_sizeof(). What do people think of that and how does this impact the patch footprint?