From patchwork Mon Feb 15 21:36:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlo Caione X-Patchwork-Id: 8338571 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A46D6C0553 for ; Wed, 17 Feb 2016 13:17:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C10CE20395 for ; Wed, 17 Feb 2016 13:17:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4BCB720272 for ; Wed, 17 Feb 2016 13:17:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 62FE02667C2; Wed, 17 Feb 2016 14:17:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 138752605C1; Wed, 17 Feb 2016 14:16:27 +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 B0365260703; Mon, 15 Feb 2016 22:36:52 +0100 (CET) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by alsa0.perex.cz (Postfix) with ESMTP id 2FEC7260695 for ; Mon, 15 Feb 2016 22:36:45 +0100 (CET) Received: by mail-wm0-f50.google.com with SMTP id c200so132206306wme.0 for ; Mon, 15 Feb 2016 13:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=NixWyFxOfJb416KwK5poaz1OkIAOrG0zu+ZiW13dUD8=; b=OsbuF74tfB6HsA+zbXuL+LlBZzIZnV3aJzhKIaDQZuPfVjTooeIX4Dbzq3dfgq9NiI vj/CeiQyZgpUTjyeoVjFF2iMKnkf7cEC4tiCRmdbBPtt2gvkX+4+0TNOlxA1asEi5swA gqie3n5M2vbOxIaVfCJIP0w5cyB/EbgSSDwOETxHpjqYq3UKRlpgZlN670+tYFJbr8F5 hVL1+Be2D/bv0PW3PmD1In5skYpYOJmrWrhGImB00hNd/pjaNsGzCAg9jk+/kssqM8E5 UgLeKIVgbF/EOelRoH5sALGbXVpMvATufEPZs7L8qFc+dBX3kwfM4GkghBSzt6MHEHCn 6+YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=NixWyFxOfJb416KwK5poaz1OkIAOrG0zu+ZiW13dUD8=; b=fenKwL+Dn5fZHMnvmqoLWZ9ZS0Q87+iebLBiWBx1IysbVvs6BfFffHD+TA5ujXbrs+ phbF5DWpEAHM5LfR/TZzASNYGL78nUhVoEbQfQhOVIG+1dXPF0DBenL+dR63lA/lCBVu kWL6oqs/95X5fIAlhqyt4oHImgJGQeCi1w29bl9R1+s1W8UQ79UWM3n7GbKZlE1w4VJq NvBIh3mzdcVJeIJB0ki/nHSZX0PaP56dHVecykyF6TBvu4vYELgy9ITeuo7hye7fjg3K w9sfvn7D3i3tbXPsMl9n6E1nKwJ562at5QZ66SxFHvQ2yl3kIHIUJ41PrL+VDiRr7UcX HICw== X-Gm-Message-State: AG10YOT8v/plJ3us/XxZCnTYuPfchFkBeFQ3a0QH2synK1INDU4wZRLQhaVmM3hqIOaTYQ== X-Received: by 10.28.23.75 with SMTP id 72mr15583194wmx.50.1455572204927; Mon, 15 Feb 2016 13:36:44 -0800 (PST) Received: from localhost.localdomain (2-238-57-164.ip242.fastwebnet.it. [2.238.57.164]) by smtp.gmail.com with ESMTPSA id r10sm27098157wjz.24.2016.02.15.13.36.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Feb 2016 13:36:43 -0800 (PST) From: Carlo Caione To: lgirdwood@gmail.com, broonie@kernel.org, vinod.koul@intel.com, yang.a.fang@intel.com, linux@endlessm.com, alsa-devel@alsa-project.org Date: Mon, 15 Feb 2016 22:36:29 +0100 Message-Id: <1455572189-11724-1-git-send-email-carlo@caione.org> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Wed, 17 Feb 2016 14:16:24 +0100 Cc: Carlo Caione Subject: [alsa-devel] [PATCH] SoC: cht_bsw_rt5645: Fix writing to string literal 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Carlo Caione We cannot use strcpy() to write to a const char * location. This is causing a 'BUG: unable to handle kernel paging request' error at boot when using the cht-bsw-rt5645 driver. With this patch we also fix a wrong indexing in the driver where the codec_name of the wrong dai_link is being overwritten. Signed-off-by: Carlo Caione --- sound/soc/intel/atom/sst-atom-controls.h | 1 + sound/soc/intel/boards/cht_bsw_rt5645.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/atom/sst-atom-controls.h b/sound/soc/intel/atom/sst-atom-controls.h index e011311..6f88d1c 100644 --- a/sound/soc/intel/atom/sst-atom-controls.h +++ b/sound/soc/intel/atom/sst-atom-controls.h @@ -30,6 +30,7 @@ enum { MERR_DPCM_AUDIO = 0, MERR_DPCM_DEEP_BUFFER, MERR_DPCM_COMPR, + MERR_DPCM_BE, }; /* define a bit for each mixer input */ diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c index e6cf800..89b4c032 100644 --- a/sound/soc/intel/boards/cht_bsw_rt5645.c +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c @@ -282,7 +282,7 @@ static struct snd_soc_dai_link cht_dailink[] = { }, /* CODEC<->CODEC link */ /* back ends */ - { + [MERR_DPCM_BE] = { .name = "SSP2-Codec", .be_id = 1, .cpu_dai_name = "ssp2-port", @@ -357,7 +357,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev) card->dev = &pdev->dev; sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id); /* set correct codec name */ - strcpy((char *)card->dai_link[2].codec_name, codec_name); + card->dai_link[MERR_DPCM_BE].codec_name = kstrdup(codec_name, GFP_KERNEL); snd_soc_card_set_drvdata(card, drv); ret_val = devm_snd_soc_register_card(&pdev->dev, card); if (ret_val) {