From patchwork Mon May 28 15:59:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 137105 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2994870lji; Mon, 28 May 2018 09:00:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpXg1lCgP9MZyXtK+XUjYHbE2MhlbwOMQR6IBDNgeqEQvWsjsJF3upZbl/jn4P3FPWEDT0q X-Received: by 2002:adf:af6b:: with SMTP id z98-v6mr10648191wrc.250.1527523228851; Mon, 28 May 2018 09:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527523228; cv=none; d=google.com; s=arc-20160816; b=Nkkj+wD7OoTgBM4nmkC10sZH+EfeYQcp8LWKy+sS2d50XDZ5EGPFILAQeiZIEa2NP1 8LJsVo0tUr2/OROthKjWYCfIqRIbAZrFFoXLq6MufvpBcNYf5OSA2qKTr85GCFnHnmHH QcYun0J2Guat3z3+iW0AaAqCawo+bdpNcXsTxP9btYI0dbluiwl93G0q8EVP5uNW8gsl 0xjVX+Yo7GYeOBihm+OXkSiHwO7xup4qlqzDC6FSSrXUvbEMNb/4+pS/URV8LAcd9sXP Tgb8/iPLUSNGNvCf16AulKnX2IzXAgZLWe7kzlVPUYOBePMJ/6DNFw46Ss5jygsEg7D8 9i+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from:delivered-to :arc-authentication-results; bh=DM0Op7OIz0SbTqxd+5nOl1KnE9L2XqLPoDuv3pxBdRY=; b=xIFzH9s7rFBoZOMFD6brCr5nzLSrRECxNsuBNjUgElo5EwCzoyUSGiUu2z+sLF19HA 9dGhBt7eclXQus2HCrK6EacxipYF5/o1QlcLtLG9VlqyS/dAGJv+1IWAaWtojIcddrEF 0IZIC/KlyapAkwLvDdx3hGKaSZXXkOQIDfxW3vL+3JG+bmB90nUJhuIPtGYX7FqVughW X29pBrT9nYXDH3/z2A7rIdD93q5h5uuEQTq52PuhdVZqa8A5Cz933ty+cMq/e5F6rW6V jDO1ODk0EnKrVd9YSojZzTMaSf5uLnBlpCzKBJdRXMpVbF1idMi9gxnBwN1kgmul5k3B pDWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id p27-v6si4332741wmi.115.2018.05.28.09.00.28; Mon, 28 May 2018 09:00:28 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7DF66267255; Mon, 28 May 2018 18:00:27 +0200 (CEST) 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 3658E2673F5; Mon, 28 May 2018 18:00:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by alsa0.perex.cz (Postfix) with ESMTP id 3A39F267252 for ; Mon, 28 May 2018 18:00:22 +0200 (CEST) Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lwqt6-1gPKA205n6-016QlS; Mon, 28 May 2018 18:00:14 +0200 From: Arnd Bergmann To: Oleksandr Andrushchenko , Jaroslav Kysela , Takashi Iwai Date: Mon, 28 May 2018 17:59:57 +0200 Message-Id: <20180528160011.2989632-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:fN5CoebTTlxn96QSe9v4PE89O3YtuNySApcFhbG3nlhmgJiC7cH m8tX2/c3Ha24tnjVHFOkDXPh1p7HbP1N153fRbzKzZcD/28PN2IP/SA1QteyuCQzhQtt36U D3ey5FsB8Evn6Qejf2r/KQSeZjTIisz8ZEb4kbQtjM7z1ScnW2c2quItwUSm24P9eKK+O6b mc61+ru3VOVZybuYAg5Rw== X-UI-Out-Filterresults: notjunk:1; V01:K0:JHXXZncySW0=:OU1qZKhNGNVUCuzxprmo8V l/O2NtAdTYnBL0nuKUZf+tqFFXQ8SQ7ZzA9f5bVjzgoKE5LiSRN36lbdbgTaifdV3MR2N8ZmW 1SB9tyQKn4/IOLBmpKNKAQAdw3EKcBjbSDpDcWi3QDrcu5Zv6ENZlt3Gin6RwrZYjlukSGfrC GlyJWThPCO6Sj0W6qrYgKFgPoqyuz5Zj5p6UpYqjwUKhFj+AYf49ZwKmWvGPAdLtJVvaibN1m Smrpgk99EUJ/AmqWTtKG8AUuQj40D7MEbfC5VO1NsdZfxux0XT4a0sh3aK+xRJyubgAUUXDVD lHBWUxWGF9rYAMXUG9UKOuSp9VzcW5WuVVQfba+HTeWFuncftCCQZwx7W6Z5JCGYClpB6eZQy icX+Sy9KPx2XmRNcOcy89rjyMDleFBDo/ctvmV6rISh4tX/cUjThwSbt7cSTL7tg6B6k5SV5/ FqjbMf3UKO8LYtc3nMP9XwO2ARxPLHKx1LSY9BBrEEc9JzAoQR4ASqaX2L0TmXz9zRfRpgODK cRHZtZ9sFh/Mc6W44qIZV7HOFVf+eGtwSMBnMcpQZxKRVNybIC4mVlwYR5Nz15yzqy88MGOCv aI6hB4clEEIckVGzRlriCXiV3/CRlbEJzRmZTCuKeeuRuo0dd7jhzDd89dUG6QXN7IqI66w6R 8iuhkiAY+eBVobTwj687CX/kgzHRc19Fhso4RMBT/tffcNUcCzFpgovOwYDQzstzQlDM= Cc: xen-devel@lists.xenproject.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Arnd Bergmann Subject: [alsa-devel] [PATCH] ALSA: xen: ensure nul-terminated device name 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 gcc-8 warns that pcm_instance->name is not necessarily terminated correctly if the input is more than 80 characters long or lacks a termination byte itself: In function 'strncpy', inlined from 'cfg_device' at sound/xen/xen_snd_front_cfg.c:399:3, inlined from 'xen_snd_front_cfg_card' at sound/xen/xen_snd_front_cfg.c:509:9: include/linux/string.h:254:9: error: '__builtin_strncpy' specified bound 80 equals destination size [-Werror=stringop-truncation] return __builtin_strncpy(p, q, size); Using strlcpy() instead of strncpy() makes this a bit safer. Fixes: fd3b36045c2c ("ALSA: xen-front: Read sound driver configuration from Xen store") Signed-off-by: Arnd Bergmann --- sound/xen/xen_snd_front_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel Reviewed-by: Oleksandr Andrushchenko diff --git a/sound/xen/xen_snd_front_cfg.c b/sound/xen/xen_snd_front_cfg.c index 38c7e1eefbb9..684b5f1d51ac 100644 --- a/sound/xen/xen_snd_front_cfg.c +++ b/sound/xen/xen_snd_front_cfg.c @@ -396,7 +396,7 @@ static int cfg_device(struct xen_snd_front_info *front_info, str = xenbus_read(XBT_NIL, device_path, XENSND_FIELD_DEVICE_NAME, NULL); if (!IS_ERR(str)) { - strncpy(pcm_instance->name, str, sizeof(pcm_instance->name)); + strlcpy(pcm_instance->name, str, sizeof(pcm_instance->name)); kfree(str); }