Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp252879ybi; Wed, 29 May 2019 20:42:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTlf+7e6aV15nynz76yTr8kDF6+bZbUzfg5rwLcUuZRthEg0fshvS8ZOHSPhlKQ93Mwrm9 X-Received: by 2002:a62:ee05:: with SMTP id e5mr1501771pfi.117.1559187743190; Wed, 29 May 2019 20:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187743; cv=none; d=google.com; s=arc-20160816; b=TcFxG6b/uSYYe4qdejHahzmjrIPZw1+2//DBB8TkExI3BRUxc3v6g5wGQsatVZy1Un g2YCFS16qvlMmaXWXA637CF/4gs6m9ZjGBB+72D9bVTTwl44xpA9IWbebq3uS/i8CuFJ 2PRbbPlBqMiwQlGp0u5h7mZKTMvUGICp4LoRHOW4Whk1869XOyosqZ+1zKwaDN2vgTt0 chiXh9qUG+1mIki+NokLC2ZPMYW2B6N/DGrMH7zdqMdDvKEiFLZn6S5KphLM20kLRDLT +vEmQ0KBsZF/Vf9XdqAcFRHgBymjrzznqM3TZwmsceH0uO7Q7HP8oEgCy8+L0ibqShrB bgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vhB/fDHq90ckboGBM2VLdA/PKAUGnURpLJ9S2X/cof4=; b=FMYnnba8snpwo5192DLwEhZcycpSbkiM8JkAXpdvyUAO5LDr04m+QSR3h6KEIfdx1d J22G/U7Mm6onLMEyvsLZ8YVtSVS1jKDyWfirAYy6uE/OIxabhNbolPVk5N69jtDE09q7 gNSvxzt/WZiZqAG6IS4/mlYfuaAHbZ08D2bEs78YW6eMC6cMyLaIiaq/BOEVw+xPYCJo 5Qxs0ce/UPDm2LSstUSZ7FIR9JxQkwgj45+Il6Q8i9yEh5FCmOJ6K5BD7zklNOnKB0Y4 FyLdQgfu9awj8f23UPTELq5eHUpNKrLufKldTy8doQ67moTnqI7d8S29Ct3tSdHnzYzM DDPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Nm6OF7BO; 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 l2si1694287pje.54.2019.05.29.20.42.06; Wed, 29 May 2019 20:42:23 -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; dkim=pass header.i=@kernel.org header.s=default header.b=Nm6OF7BO; 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 S1732452AbfE3DlD (ORCPT + 99 others); Wed, 29 May 2019 23:41:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732547AbfE3DVY (ORCPT ); Wed, 29 May 2019 23:21:24 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (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 2472924A0B; Thu, 30 May 2019 03:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186484; bh=WZ2amSC0Wh8PX9tKxg7juenTTG5QF70nnrLErRhweA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nm6OF7BO0iG2W1xMXe66qBWOlbM7rLYa8LmQ0A5cnjl4X9KFQclEb4oJPkzz7ioJR GrCiuJlzS8dHTOGOADM3ler+mkqyVT1x75vvNeDa1HJh1lZmimJOivAsHgox5cmjiJ CLhygcYfpNIrkCJRLIm+9uvleF4ujeqOLcmdp/5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Nick Desaulniers , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.9 122/128] media: saa7146: avoid high stack usage with clang Date: Wed, 29 May 2019 20:07:34 -0700 Message-Id: <20190530030456.369529231@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 03aa4f191a36f33fce015387f84efa0eee94408e ] Two saa7146/hexium files contain a construct that causes a warning when built with clang: drivers/media/pci/saa7146/hexium_orion.c:210:12: error: stack frame size of 2272 bytes in function 'hexium_probe' [-Werror,-Wframe-larger-than=] 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=] static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) ^ 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. Link: https://bugs.llvm.org/show_bug.cgi?id=40776 Signed-off-by: Arnd Bergmann Reviewed-by: Nick Desaulniers Signed-off-by: Hans Verkuil [hverkuil-cisco@xs4all.nl: fix checkpatch warnings] Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/saa7146/hexium_gemini.c | 5 ++--- drivers/media/pci/saa7146/hexium_orion.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c index c889ec9f8a5a0..f5fc8bcbd14b1 100644 --- 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, struct saa7146_pci_extension_d /* enable i2c-port pins */ saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); - hexium->i2c_adapter = (struct i2c_adapter) { - .name = "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"); diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c index c306a92e89095..dc07ca37ebd06 100644 --- a/drivers/media/pci/saa7146/hexium_orion.c +++ b/drivers/media/pci/saa7146/hexium_orion.c @@ -232,9 +232,8 @@ static int hexium_probe(struct saa7146_dev *dev) saa7146_write(dev, DD1_STREAM_B, 0x00000000); saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26)); - hexium->i2c_adapter = (struct i2c_adapter) { - .name = "hexium orion", - }; + strscpy(hexium->i2c_adapter.name, "hexium orion", + 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"); -- 2.20.1