Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8284397ybi; Thu, 6 Jun 2019 09:34:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg4isfiyx2v9pRQ8p5Yjko3pA/s4GE52CSteJb68fZ/Q1Zgk2+xdlUPQwLSYfBevwEhSqQ X-Received: by 2002:a17:90a:254e:: with SMTP id j72mr759803pje.11.1559838893383; Thu, 06 Jun 2019 09:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559838893; cv=none; d=google.com; s=arc-20160816; b=I7sXjSdWEkooLXHp9+IPCC9aSTMUA84dcCdCQHDLdCRDB0FrrrybPl304i45LzxHep 1wTZqo3lMAV5ANE4F5vEqWP0Geh7VWf5CJK5Kmf5s5E9YcNSB8JXAzakPjHPoGNdMwMO TEflnXaSZT9vmt6d2r1pu2HvyqcsUjQyAzfyB4n1F7T9/zQGzUbCTR5OQ5+ta4ZL2ExK hsj8mXDcEr/UCIKCYgcqfXfY6gJTWIWyixb9KPVuyVmTce/oH21MLYEmirK0KlieYHFv tAgJCd/uug27nqlmt/IuqCXrycQh/L3gFlRBl16SiKG31lAKTCylAOHvVlfiQip2aLdp M13w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ayM+BUHcKYdwOn/CZpuyDhOksE9Eb7h8mKkJswXmQ8w=; b=mamPGtfnW60WpZyFxrmN5v5Dy75voZJpgmckagMxZoQut1aSaL4rwR1woG+Jsvex7D Y7KEjO/cBQCplYqlKp4FsdOztMrVeA79//+tUJ4EGOsLLpKbwfnGESX35QN0u14oF1us atXuEQjO5/sZ1hTuSGuH/jq1upICiwBcYGrwa+zvPeFZQe7x7WYxMpEGxSZbC57vx6RI eWHfljrY3Y2PpH03Ed5NV+BM63cBpYfmTkAFzG7lEIoHQ77AN1G1+LZEUVzunCzFsfL+ yb6soOlHdWWycqLFpdxaz5VYldeHdr9UFCQioj4m0OjJQ9yOAIMEEkP9uYxya7Dgs1I0 3IPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si2109612pli.151.2019.06.06.09.34.37; Thu, 06 Jun 2019 09:34:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727515AbfFFLol (ORCPT + 99 others); Thu, 6 Jun 2019 07:44:41 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:48354 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727157AbfFFLol (ORCPT ); Thu, 6 Jun 2019 07:44:41 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 24ABD80238; Thu, 6 Jun 2019 13:44:30 +0200 (CEST) Date: Thu, 6 Jun 2019 13:44:39 +0200 From: Pavel Machek To: pavel@ucw.cz Cc: linux-kernel@vger.kernel.org, Arnd Bergmann , Nick Desaulniers , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: Re: [PATCH 4.19 262/276] media: saa7146: avoid high stack usage with clang Message-ID: <20190606114439.GA27432@amd> References: <20190530030523.133519668@linuxfoundation.org> <20190530030541.589347419@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline In-Reply-To: <20190530030541.589347419@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > Two saa7146/hexium files contain a construct that causes a warning > when built with clang: >=20 > drivers/media/pci/saa7146/hexium_orion.c:210:12: error: stack frame size = of 2272 bytes in function 'hexium_probe' > [-Werror,-Wframe-larger-than=3D] > static int hexium_probe(struct saa7146_dev *dev) > ^ > drivers/media/pci/saa7146/hexium_gemini.c:257:12: error: stack frame size= of 2304 bytes in function 'hexium_attach' > [-Werror,-Wframe-larger-than=3D] > static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_exte= nsion_data *info) > ^ >=20 > This one happens regardless of KASAN, and the problem is that a > constructor to initialize a dynamically allocated structure leads > to a copy of that structure on the stack, whereas gcc initializes > it in place. >=20 > Link: https://bugs.llvm.org/show_bug.cgi?id=3D40776 > --- a/drivers/media/pci/saa7146/hexium_gemini.c > +++ b/drivers/media/pci/saa7146/hexium_gemini.c > @@ -270,9 +270,8 @@ static int hexium_attach(struct saa7146_dev *dev, str= uct saa7146_pci_extension_d > /* enable i2c-port pins */ > saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); > =20 > - hexium->i2c_adapter =3D (struct i2c_adapter) { > - .name =3D "hexium gemini", > - }; > + strscpy(hexium->i2c_adapter.name, "hexium gemini", > + sizeof(hexium->i2c_adapter.name)); > saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_= BIT_RATE_480); > if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { > DEB_S("cannot register i2c-device. skipping.\n"); As a sideeffect, this removes zero-initialization from hexium->i2c_adapter. Is that intended / correct? [I tried looked at saa7146_i2c_adapter_prepare(), and that does not initialize all the fields, either.] Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --M9NhX3UHpAaciwkO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlz4/KcACgkQMOfwapXb+vJG7wCdHGx8wDKp0FUCK2ZhbPtRF8in mRwAn3tACATCrLateDJTUNcqDmzymziv =SRoZ -----END PGP SIGNATURE----- --M9NhX3UHpAaciwkO--