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=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 96267C352AA for ; Tue, 1 Oct 2019 13:57:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69CAD21906 for ; Tue, 1 Oct 2019 13:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388904AbfJAN5L (ORCPT ); Tue, 1 Oct 2019 09:57:11 -0400 Received: from s3.sipsolutions.net ([144.76.43.62]:34512 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388856AbfJAN5L (ORCPT ); Tue, 1 Oct 2019 09:57:11 -0400 Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.92.2) (envelope-from ) id 1iFIeI-0001pX-G2; Tue, 01 Oct 2019 15:57:06 +0200 Message-ID: <9bbf73e318df17d179014937cb6c1335fb303611.camel@sipsolutions.net> Subject: Re: [PATCH net v4 01/12] net: core: limit nested device depth From: Johannes Berg To: Taehee Yoo Cc: David Miller , Netdev , linux-wireless@vger.kernel.org, Jakub Kicinski , j.vosburgh@gmail.com, vfalico@gmail.com, Andy Gospodarek , =?UTF-8?Q?Ji=C5=99=C3=AD_P=C3=ADrko?= , sd@queasysnail.net, Roopa Prabhu , saeedm@mellanox.com, manishc@marvell.com, rahulv@marvell.com, kys@microsoft.com, haiyangz@microsoft.com, Stephen Hemminger , sashal@kernel.org, hare@suse.de, varun@chelsio.com, ubraun@linux.ibm.com, kgraul@linux.ibm.com, Jay Vosburgh , Cody Schuffelen , bjorn@mork.no Date: Tue, 01 Oct 2019 15:57:05 +0200 In-Reply-To: (sfid-20191001_155348_267769_C0F821E2) References: <20190928164843.31800-1-ap420073@gmail.com> <20190928164843.31800-2-ap420073@gmail.com> <39e879f59ad3b219901839d1511fc96886bf94fb.camel@sipsolutions.net> (sfid-20191001_155348_267769_C0F821E2) Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, (jumping out now, forgive me for being so brief) > If I understand correctly, you said about the alignment of > "lower_level" and "upper_level". > I thought this place is a fine position for variables as regards the > alignment and I didn't try to put each variable in different places. > > If I misunderstood your mention, please let me know. Not sure what you mean, alignment doesn't matter for them (they're u8). I was thinking of the packing for the overall struct, we have: unsigned int max_mtu; unsigned short type; unsigned short hard_header_len; unsigned char min_header_len; + unsigned char upper_level, lower_level; unsigned short needed_headroom; unsigned short needed_tailroom; Previously, there was a one byte hole at that spot due to a single "unsigned char" (after something aligned at least 4 bytes) followed by "unsigned short" - now you push that out a bit. If you place the variables a bit lower, below "name_assign_type", you probably fill a hole instead. Check out the 'pahole' tool. johannes