Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1840656imm; Mon, 3 Sep 2018 10:49:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbAexm2OQG5PrR41GJtdFEq3Ew32Mqxqa6/2P1Ay0w5wIdjL6DMyF7GT6T5ZBZJXs/iX64P X-Received: by 2002:a63:65c2:: with SMTP id z185-v6mr27419395pgb.276.1535996948686; Mon, 03 Sep 2018 10:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535996948; cv=none; d=google.com; s=arc-20160816; b=SC9ZBrxsbS6IvEZpOInUCgSrUVuCcgaKBwk7lZMSwBdLyF914zpTTYUaIc2WxVHcS8 TTBfhLCyDu5kGWrOhEhR1dNgUv2XRiZc01FKrYU4Ur+iI7RAG9LfY35yIpJGY1qfh6zH ppoRb6hnblUm434EV6kBI8hPcD04EPZncwx+l47Rx806aIgqSIXVB3m2yjVeYo0IHMmF UJCsXn7FTYbY3xOQGFY4njLteuQDVv1VpQECCuZB9Ju5Ivr6MaTEEyunvPMPOuK8tFns zJBE8C31pcexUnfimVxWSu6RVBKcHDTHnb9FKlvyWDmesH3UwNwmNjAJ389NxVPLJ3kH 73rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cG6VVcnmkE3eoU7/egqynFm2IWqawxpFwhSMkt9JTy4=; b=ol9HiZFx39RQt771o2xlqKm1MoDjgBZGTihvuBQZ4S+mRQCi9iTQExcSGjk56DTLVy qGoKhzf+pAws0hraPOeKSfxb0zEIsQAhuz+7uYiP6BGBwwmPIGWtpIMv7D4FaXQY6Fx8 qrnqKbLN28ajGyPjoyN/TY/DtKV3uRjmwq2CAi5hDw1MSIW/haTyX60GqL4uX67VMMXa x3DUywU7PChs8Gw/jwViOCrJwTRM2ACeGhi+er/TlTpsHhguw8+bmQwxqI5wKdq7xnMn l5BKMCKpGORyaDODruJPxoRK4VPd2wLyb0g0LlqS3S/PBdyZ/ws4ZCti5cbJSdWYBphI zAmQ== 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 i64-v6si18901671pli.56.2018.09.03.10.48.53; Mon, 03 Sep 2018 10:49:08 -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 S1729901AbeICVhc (ORCPT + 99 others); Mon, 3 Sep 2018 17:37:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42570 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728390AbeICVh3 (ORCPT ); Mon, 3 Sep 2018 17:37:29 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 37121D06; Mon, 3 Sep 2018 17:16:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugeniu Rosca , Felipe Balbi , Sasha Levin Subject: [PATCH 4.14 019/165] usb: gadget: u_audio: fix pcm/card naming in g_audio_setup() Date: Mon, 3 Sep 2018 18:55:05 +0200 Message-Id: <20180903165655.994505525@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165655.003605184@linuxfoundation.org> References: <20180903165655.003605184@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eugeniu Rosca [ Upstream commit dfa042fa310caa475667b8c38d852f14439e0b01 ] Fix below smatch (v0.5.0-4443-g69e9094e11c1) warnings: drivers/usb/gadget/function/u_audio.c:607 g_audio_setup() warn: strcpy() 'pcm_name' of unknown size might be too large for 'pcm->name' drivers/usb/gadget/function/u_audio.c:614 g_audio_setup() warn: strcpy() 'card_name' of unknown size might be too large for 'card->driver' drivers/usb/gadget/function/u_audio.c:615 g_audio_setup() warn: strcpy() 'card_name' of unknown size might be too large for 'card->shortname' Below commits performed a similar 's/strcpy/strlcpy/' rework: * v2.6.31 commit 8372d4980fbc ("ALSA: ctxfi - Fix PCM device naming") * v4.14 commit 003d3e70dbeb ("ALSA: ad1848: fix format string overflow warning") * v4.14 commit 6d8b04de87e1 ("ALSA: cs423x: fix format string overflow warning") Fixes: eb9fecb9e69b ("usb: gadget: f_uac2: split out audio core") Signed-off-by: Eugeniu Rosca Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/u_audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -604,15 +604,15 @@ int g_audio_setup(struct g_audio *g_audi if (err < 0) goto snd_fail; - strcpy(pcm->name, pcm_name); + strlcpy(pcm->name, pcm_name, sizeof(pcm->name)); pcm->private_data = uac; uac->pcm = pcm; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &uac_pcm_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &uac_pcm_ops); - strcpy(card->driver, card_name); - strcpy(card->shortname, card_name); + strlcpy(card->driver, card_name, sizeof(card->driver)); + strlcpy(card->shortname, card_name, sizeof(card->shortname)); sprintf(card->longname, "%s %i", card_name, card->dev->id); snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,