Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1032988ybe; Wed, 4 Sep 2019 11:27:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5VNHOJOcFPniPrGz/ZtRIMhnduPAoscwZ2c3hBceREBVUvEOJI/rVEDlsbLkRORSX6G3P X-Received: by 2002:a17:902:a9c7:: with SMTP id b7mr17033382plr.133.1567621653875; Wed, 04 Sep 2019 11:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621653; cv=none; d=google.com; s=arc-20160816; b=oEPWmyxNommoC/lriDIZnkaiPKU8wskbuwoCon6X66icBHmV5Ld6+HzjfQSwq3Qkr5 b7XiXiosKzKefSwsxoNsOwBySoWjs1iF9Ch/uMQ1wwWBKU10Fq5DnEedO2NelMOeQfxm UsxhzFi0sJ1P+ocKoCbxwtuEx+sEmdstWUeK+WfzqurRWIOmoGooCyHiytixr0iNHAdB Z+m0p/fxiEvHJbATnSmCz4h2QDsrjfhlKIjOzH/PEstmZbPfp6eXcKJTq7aI6jrSJ+A/ I6GL63jxoHkmRQD6PHq5/ZDSgCrciqIhLAX8A4/u52kSQLBHssiYOl1pXYo3ObipRUtV e7pQ== 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=VcHUPmxUjnwxvBqSP1iDxZLAS9+bKv/h5qZ4z3MTa+4=; b=TzR0oRKVtedkh+QiXOH7ctcqxfVSDazLXgp7I8lkbvLL1u9R9aUSuFJ0z+i+FeGmQp HrriAIpgMitLuRmegfOYYzJIyFXGBdvCsx7VAqPMOKDVpad3LNflVyv7S2o603brNI8k 7xEj2+uu44USCU7OWrxxT/QuBFxjOsH9ESczkwbwHiQx7Fk0BVVhl1IcbIdwNgZWHXAR fM/YTXriAHgwD26kZn9Lm68sCN42nfhmDEosNjA0MoKj90WGfgymsfLq9cQdx2VcPihl YPz0XQLtU40CKdH4fh6W1/VW8jDUcSy81LnMtR7EP9UtQ4Q9XzOfJNapNKh/xcD+z5ny ucVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="yl//7Gqw"; 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 h26si17702654pgl.398.2019.09.04.11.27.18; Wed, 04 Sep 2019 11:27:33 -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="yl//7Gqw"; 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 S2387798AbfIDR7F (ORCPT + 99 others); Wed, 4 Sep 2019 13:59:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:37750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732997AbfIDR7D (ORCPT ); Wed, 4 Sep 2019 13:59:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 ADD5423400; Wed, 4 Sep 2019 17:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567619943; bh=wfm3p1mSjCIv3JJ5U8S/ye/6/qwD8rPoPH5Qc/F+lTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yl//7GqwnhjprxyKmt9rxl9VUyj6BAUvHxQD7rVxJxSqkQNF4iR2J9Ff/Oz3o3l/o oIIDVRIMEQpWJU2LZBgSAGSjtNDb11ct4uZP40wk2RxRpSxo4Eh80zsUAlx3UpPVxX /pqwKbtjBSnBfMFIfKfQKNgN1q01IDEvO0q66U80= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Xiayang , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 4.9 15/83] can: sja1000: force the string buffer NULL-terminated Date: Wed, 4 Sep 2019 19:53:07 +0200 Message-Id: <20190904175305.226467808@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175303.488266791@linuxfoundation.org> References: <20190904175303.488266791@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 cd28aa2e056cd1ea79fc5f24eed0ce868c6cab5c ] strncpy() does not ensure NULL-termination when the input string size equals to the destination buffer size IFNAMSIZ. The output string 'name' is passed to dev_info which relies on NULL-termination. Use strlcpy() instead. This issue is identified by a Coccinelle script. Signed-off-by: Wang Xiayang Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin --- drivers/net/can/sja1000/peak_pcmcia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/sja1000/peak_pcmcia.c b/drivers/net/can/sja1000/peak_pcmcia.c index dd56133cc4616..fc9f8b01ecae2 100644 --- a/drivers/net/can/sja1000/peak_pcmcia.c +++ b/drivers/net/can/sja1000/peak_pcmcia.c @@ -487,7 +487,7 @@ static void pcan_free_channels(struct pcan_pccard *card) if (!netdev) continue; - strncpy(name, netdev->name, IFNAMSIZ); + strlcpy(name, netdev->name, IFNAMSIZ); unregister_sja1000dev(netdev); -- 2.20.1