Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp246865ybi; Wed, 29 May 2019 20:34:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzddF9rZgRlzPid/C3EMrYEiFIPtqaKy6/Wvr0qp8x7HFcB9++6fJrUFlgrf06NouiOtj/O X-Received: by 2002:a62:7fcd:: with SMTP id a196mr1493957pfd.195.1559187281624; Wed, 29 May 2019 20:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187281; cv=none; d=google.com; s=arc-20160816; b=AitKjHp9huKOPr5ClKceSHNlPxr8FQjaQbfP3mpT7JjOS1OXBt69XCWy5+iuouK3FJ 8ymDv7K0eHZg19zEVy9Q64U3m2U6oPM9ZRmEn0B8P+RLCJhRKHW5h3iYI30qaGKWPSNw o7hnCfy+xQ12X7GwNlRxVO1CJw75VxMwZgkJS8LqNGPXPhpsdjOrBOHGIsqYRhEhJ60R 1yE1CwqpRDDl2/o04opHDFyY7hsJNG7qSC0Sa+9cLIu8UeqCN+ROMoxV/w4k7drDivkk fCYWydcbrSA5/+iET2cW5Vn4srtulXu6m3wshZzRvjE42cn9A1QzGMmOarzpgAfSST00 /Hkw== 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=VkstDr77DVIA8TjD7pxHBQ/LgoPrKf6XebWyvNt3BIc=; b=gAHFZ+DT5V8qZFAxUCbCNPOV2fBuAuluPDk0DWK1uNQEoy4+XhV9V82VTzlmBPxqUq HHgajcsoMI0+Bfsvxckrtf4fLih92LFIaaoKjk7wCpKvW6Dg+3vnGuF1Mb/z86cIqgGy N7BY1OG1SmF6nypLcuKtZmGpE4QPRylW9d02uobMU0+cLqgeeurIG9BNux+Xyaka0hid SSBYa2Au9xzUFZtDQHS//wAajh6+HyPOOPv/nGUjSnCo0gA1tjTMTagd6RG0OW0WFwRE oFLwmfQ3cahqQznrkY8oSe0HShlS2V+2n/+yNdGpWJvSolhVlOYYnySkAXsClJbo7Pam 8TNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="n/4BAR6D"; 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.34.25; Wed, 29 May 2019 20:34:41 -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="n/4BAR6D"; 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 S2388203AbfE3D2j (ORCPT + 99 others); Wed, 29 May 2019 23:28:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:57638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730463AbfE3DUC (ORCPT ); Wed, 29 May 2019 23:20:02 -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 1615E248AF; Thu, 30 May 2019 03:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186401; bh=hM2m/GbTGIy5XDD6dReCrxzL3V8TUzrk+cjuvLwjHKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/4BAR6DDWNghgNtyTO8BcwZ2VdYANqRQ6Rn8+mlJ5G2RhBlyvRNHALXkKE+Zr67X Nr0ie1x2u+QpX3fvY0tzrEAAzK0zqqFRpTHqmeUqDwwQxA/j3xLWhfopLXJ0SAMnRv kbvFdOUmkj5JTNpF7zDNuj2tgg7oK0Ipo7OcZbNM= 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.14 184/193] media: saa7146: avoid high stack usage with clang Date: Wed, 29 May 2019 20:07:18 -0700 Message-Id: <20190530030512.918654514@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@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 f708cab01fef1..934332f1fd8e6 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 01f01580c7cac..cb71653a66694 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