From patchwork Thu Dec 13 04:35:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 10728149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A46A7174F for ; Thu, 13 Dec 2018 08:36:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94DE32B984 for ; Thu, 13 Dec 2018 08:36:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88E362BA10; Thu, 13 Dec 2018 08:36:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E25472BA02 for ; Thu, 13 Dec 2018 08:36:01 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 414E6267CA0; Thu, 13 Dec 2018 09:35:26 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D1E6B267C74; Thu, 13 Dec 2018 05:36:04 +0100 (CET) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by alsa0.perex.cz (Postfix) with ESMTP id D55B7267C45 for ; Thu, 13 Dec 2018 05:36:01 +0100 (CET) Received: by mail-wm1-f68.google.com with SMTP id c126so951156wmh.0 for ; Wed, 12 Dec 2018 20:36:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cDVi6ueEqLDxcXtda0yxNBgbEeJ7nCgRPmiJUJPQ+Ko=; b=csGmEa0j6+x2Xccji99Ik0ST6G4f58oGUDIYqsdqzK119bGHBF74DIVNpp82fUMBpQ wfkTN6G9DdBekhAopeH6W560C2pTm3DGv1o+jXnWfFrJzs2QaU6xsVsXijjbgpLdt+me 9uidmDpovCkxlq/k0fWDKyAzLWUFDV+o/yWy7qt6FBHVUd0ndoVtImjn3woIsL3qxBDM kCA2G/WqAw2v9JZPdcR1dZolEUo0zjM29p4dUCTQc3AN3ZprhUsVu/R67SAebPSNwpZY TdPFLvkeE+9xNzmaysOOTjhE9L7ELSk815EO/XJWh1pReQrg0uuXlX60f/cshss2YifE 0AyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cDVi6ueEqLDxcXtda0yxNBgbEeJ7nCgRPmiJUJPQ+Ko=; b=cEobT13FMss53BF0Onw1+OKtf/FT8VtqI8sTD6C3dK517Hq0b5ni/iYdK65FKvWi91 6tDk/30q7GWu6T3RV6Sad47/dTvFM2TRIsyRathfAn9uvB5vfNBA+gRTxAHyNnXVr2di dneSDRJuclC7iEoHUH2SyCPiQC4gFgGv+LxwMMhfxfY9W1TxMMEI/FCPXD95z9P1Rb1Y LTqvtSCbhX3JyFnNy4i5KrLokxGLI/oQLC9MYrutRo9zxyVLSSMh4R4nZv+uN65G4wTS /5x05jHxzP+6ARgNgG+ik9Zv4Y96rqYrwUNRr5rUYIwBH0yCMHGN8SEDpwST3zNTCGTk d4Lw== X-Gm-Message-State: AA+aEWav2o8phHNirS/2fGnOZnBOOQINYmLHFuIf28EduBWy4ceBs5PG hHiprMbklY5GVyeYZcr060Y= X-Google-Smtp-Source: AFSGD/UdYWzmZ5sXZEH8KUc+nx7k88QWwX2f3hBCDjkjrkwL/0ugz8lBripstufU3l9luIlWUy4Zrg== X-Received: by 2002:a1c:70b:: with SMTP id 11mr9028447wmh.74.1544675760291; Wed, 12 Dec 2018 20:36:00 -0800 (PST) Received: from localhost.localdomain ([2a01:4f8:10b:24a5::2]) by smtp.gmail.com with ESMTPSA id e17sm661759wri.36.2018.12.12.20.35.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 20:35:59 -0800 (PST) From: Nathan Chancellor To: Mark Brown , Liam Girdwood Date: Wed, 12 Dec 2018 21:35:48 -0700 Message-Id: <20181213043548.29747-1-natechancellor@gmail.com> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 13 Dec 2018 09:35:12 +0100 Cc: Nathan Chancellor , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Kuninori Morimoto Subject: [alsa-devel] [PATCH] ASoC: simple-card: Dereference pointer for memcpy sizeof in asoc_simple_card_probe X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Clang warns: sound/soc/generic/simple-card.c:462:6: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'struct asoc_simple_dai *' as the source; expected 'struct asoc_simple_dai' or an explicit length [-Wsizeof-pointer-memaccess] sizeof(priv->dai_props->cpu_dai)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sound/soc/generic/simple-card.c:464:6: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'struct asoc_simple_dai *' as the source; expected 'struct asoc_simple_dai' or an explicit length [-Wsizeof-pointer-memaccess] sizeof(priv->dai_props->codec_dai)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. Commit 4fb7f4df49d3 ("ASoC: simple-card: use cpu/codec pointer on simple_dai_props") updated {cpu,codec}_dai to be pointers in struct simple_dai_props but didn't update these locations to dereference the pointers to get the proper size of their contents. Signed-off-by: Nathan Chancellor --- sound/soc/generic/simple-card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 766123485d7c..d4738d3eb2f1 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -459,9 +459,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev) dai_link->dai_fmt = cinfo->daifmt; dai_link->init = asoc_simple_card_dai_init; memcpy(&priv->dai_props->cpu_dai, &cinfo->cpu_dai, - sizeof(priv->dai_props->cpu_dai)); + sizeof(*priv->dai_props->cpu_dai)); memcpy(&priv->dai_props->codec_dai, &cinfo->codec_dai, - sizeof(priv->dai_props->codec_dai)); + sizeof(*priv->dai_props->codec_dai)); } snd_soc_card_set_drvdata(card, priv);