From owner-svn-src-all@freebsd.org Thu Mar 5 17:44:15 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 569C526F3AC; Thu, 5 Mar 2020 17:44:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 48YJ5p5dMKz4TXR; Thu, 5 Mar 2020 17:44:14 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id 025HiB55033740 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 5 Mar 2020 09:44:11 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id 025HiBb0033739; Thu, 5 Mar 2020 09:44:11 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 5 Mar 2020 09:44:11 -0800 From: Gleb Smirnoff To: Slawa Olhovchenkov Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Dimitry Andric Subject: Re: svn commit: r358655 - head/sbin/mount_nfs Message-ID: <20200305174411.GV5741@FreeBSD.org> References: <202003042227.024MRGsW072613@repo.freebsd.org> <244e28ea-1217-cefc-354e-02ecb201637a@FreeBSD.org> <20200305163350.GU5741@FreeBSD.org> <20200305172454.GJ8028@zxy.spb.ru> <20200305173515.GK8028@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200305173515.GK8028@zxy.spb.ru> X-Rspamd-Queue-Id: 48YJ5p5dMKz4TXR X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-0.09 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_SPAM_MEDIUM(0.90)[0.902,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; NEURAL_HAM_LONG(-0.99)[-0.988,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2020 17:44:15 -0000 On Thu, Mar 05, 2020 at 08:35:15PM +0300, Slawa Olhovchenkov wrote: S> > > D> sbin/mount_nfs/mount_nfs.c:549:10: error: cast from 'char *' to 'struct S> > > D> if_msghdr *' increases required alignment from 1 to 4 S> > > D> [-Werror,-Wcast-align] S> > > D> ifm = (struct if_msghdr *)buf; S> > > D> ^~~~~~~~~~~~~~~~~~~~~~~ S> > > D> 1 error generated. S> > > D> S> > > D> In practice I don't think the buffer can ever get misaligned, so can you S> > > D> please add a NO_WCAST_ALIGN= to the Makefile? S> > > S> > > route(8) handles the same problem via intermediate (void *) cast. What is S> > > preferred way to solve the problem? Change compiler flags file wide, or S> > > just through (void *) cast? S> > S> > Copy to aligned buffer or got SIGBUS on some architectures? S> S> char buf[2048] __aligned(__alignof(struct if_msghdr)); S> S> resolve this watning. Thanks, Slawa! I think this is the most elegant solution. -- Gleb Smirnoff