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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A835ECAAA1 for ; Tue, 30 Aug 2022 08:53:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mN5AA9eES01GnsJ/TyE/bs+RtSw9T3kLc1gPdaVADVk=; b=NPiq4bsf3e2Oas oKGNXG+W4Pd/5uWicsmPpcgs4XYMrS4daF4tC/BgzxJ3uKB1XvSc78CLliRiyvRo3fMfuJtzp2L8u UIK812u5QT0FuVoNwZiigJ1Ta9nsW0PP9ROMfIGwE9Y1d35/BkdvpHen8KsG51yarhp21XYs3+4ra zv5xeHh6HoN2XreDLsHwXTdIy3VqKvPWW47LursbRqSz40fkrbkvl/u7E521W0ieKPinSrvI5HtX4 mB9liehJrvt6S+nc94npgXxlpWJUXzgGcEs1n03SVji4+WiAu10RCgOGKlSVKdlDR50PwxLj37EUI IHmyIh1G4HhbXxVbh87A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSwyw-00FLQS-PV; Tue, 30 Aug 2022 08:52:26 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSwyt-00FLPb-KJ for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2022 08:52:24 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 27F0B6155B; Tue, 30 Aug 2022 08:52:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE725C433D7; Tue, 30 Aug 2022 08:52:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661849542; bh=GfTk307VAPbulMgNaAUsMDt2ahKUcbPofgSTa8PhAiQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DyAjFc9HC2ltJIBwtejCLHGP0+sh4+HuJH4YfCl6P8VLxiBLSdh4bYf4KeN7al3lV 5PLJQlBjMnWL25yCyRqMVhzRZ3gM02EAmzOaeMviC4al0M8ZWWAUGB8MNMawubTwtT eF2q9bnUCiff/VsE6cHX2ADN9bnv18PGyeNm8ssg= Date: Tue, 30 Aug 2022 10:52:19 +0200 From: Greg Kroah-Hartman To: Ilpo =?iso-8859-1?Q?J=E4rvinen?= Subject: Re: [PATCH v2 4/4] serial: Add kserial_rs485 to avoid wasted space due to .padding Message-ID: References: <20220830072956.3630-1-ilpo.jarvinen@linux.intel.com> <20220830072956.3630-5-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220830072956.3630-5-ilpo.jarvinen@linux.intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220830_015223_724754_F4B75B21 X-CRM114-Status: GOOD ( 15.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , linux-doc@vger.kernel.org, Alexandre Torgue , linux-kernel@vger.kernel.org, Fabio Estevam , linux-stm32@st-md-mailman.stormreply.com, Jonathan Corbet , Jiri Slaby , Russell King , Lino Sanfilippo , NXP Linux Team , linux-serial@vger.kernel.org, Pengutronix Kernel Team , Sascha Hauer , Vladimir Zapolskiy , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Richard Genoud , Maxime Coquelin , Shawn Guo , Claudiu Beznea Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Aug 30, 2022 at 10:29:56AM +0300, Ilpo J=E4rvinen wrote: > -static int serial_rs485_from_user(struct serial_rs485 *rs485, > +static int serial_rs485_from_user(struct kserial_rs485 *rs485, > const struct serial_rs485 __user *rs485_user) > { > - if (copy_from_user(rs485, rs485_user, sizeof(*rs485))) > + struct serial_rs485 rs485_uapi; > + > + if (copy_from_user(&rs485_uapi, rs485_user, sizeof(*rs485))) > return -EFAULT; > = > + *rs485 =3D *((struct kserial_rs485 *)&rs485_uapi); Ah, you are mapping this on top of the existing structure, so there was no padding in the original one, why say that? > +/* > + * Compile-time asserts for struct kserial_rs485 and struct serial_rs485= equality > + * (except padding). This does not take into account any padding, in fact it's the opposite as all of this: > + */ > +static_assert(offsetof(struct kserial_rs485, flags) =3D=3D > + offsetof(struct serial_rs485, flags)); > +static_assert(offsetof(struct kserial_rs485, delay_rts_before_send) =3D= =3D > + offsetof(struct serial_rs485, delay_rts_before_send)); > +static_assert(offsetof(struct kserial_rs485, delay_rts_after_send) =3D= =3D > + offsetof(struct serial_rs485, delay_rts_after_send)); > +static_assert(offsetof(struct kserial_rs485, addr_recv) =3D=3D > + offsetof(struct serial_rs485, addr_recv)); > +static_assert(offsetof(struct kserial_rs485, addr_dest) =3D=3D > + offsetof(struct serial_rs485, addr_dest)); > +static_assert(sizeof(struct kserial_rs485) <=3D sizeof(struct serial_rs4= 85)); Is there to ensure that the offsets are exactly the same, no padding involved anywhere. So I don't understand the problem you are trying to solve here, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel