Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5237359ybl; Tue, 27 Aug 2019 01:19:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqg44j9xdhJff09K3eTsHr+X0oGSwoBrhHJiWbjpXWsh4lFQ2je22kNP8JEBSmss/0Unhe X-Received: by 2002:a17:902:4581:: with SMTP id n1mr11115909pld.310.1566893960163; Tue, 27 Aug 2019 01:19:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893960; cv=none; d=google.com; s=arc-20160816; b=fIIaCb0+jtz28Oowdj9k/BSEkC2QZx64zTO+/Jh8ZS3ADvv4FeL77mfWKVV+RCDgee 1VWGxwxEg7jULlVIGW55MPuX5CiQ+7hhhDHnArG44H0ZpLeAA7njjw9XmRS912AvbnJ3 dQS4/MJuU/SvruH7xGY3qBPTDeG/vCE/s+kXbtJYMXLQD1axNGuQqV8nSebsmO4qxYSg aNRulzxML9sSGP2SNcYUA8fFY5caPKffUsFWuzsRZUe81xFEhhjvNdatIwX2ghL+b/8U UqbpKWqgdw7FnQFSB9j7/s7VEVCCYXgdAQpfyeOrYIwwJlGnxvcYHNDKXsez7Mzjzzze yCAg== 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=ZsgcIxC3f42Q/6goryWbMrMt+lUyQvsea0MmKIlBRm4met9UjecsoWPe4sv9Dqtclf LIaZQfzyZimqJy5gWQV59+c2QyRn90BtgiXLoAtTVgUwd3ingcpOKXVpp4uXRbZ/s9vZ GC46Y0pTEbQgI4wD3XWqQ+MuFbPLNwUSqSU9Oa++F4lYasyI4FeadVoFc//mpE66Mb1z WfI9KXAAUqowqHvhNS6LpVTj8D3fo/PlInCNqeSMJZ7VrimgxC9q+SXRSksK6fHLXYUj MRypCeiNs3xDmZiGoE3x3hcgqwnAIf61KJcyJPBiNz+8LRUiM+umOOxFGMfxDXIqDQQU ulIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f97nO4Oq; 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 c25si10919803pgm.73.2019.08.27.01.19.04; Tue, 27 Aug 2019 01:19:20 -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=f97nO4Oq; 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 S1729284AbfH0HwJ (ORCPT + 99 others); Tue, 27 Aug 2019 03:52:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:43408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729017AbfH0HwH (ORCPT ); Tue, 27 Aug 2019 03:52:07 -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 E0473217F5; Tue, 27 Aug 2019 07:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892327; bh=wfm3p1mSjCIv3JJ5U8S/ye/6/qwD8rPoPH5Qc/F+lTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f97nO4OqiZ36dXAkzIMhhT2cMH1x6kSaLoP/7jQ1wW6wZulMCAJ8sLDOWpDrXUo3/ 4iJndNZXSlcwLaHVeYAh7fWP5xAhcztHxh4npm2MJYQcnmckGu/cccpBul0HSFa7j9 vxG3NSrpyc9XADWN0yM9jJBJyusm8L+k+/9v1p8E= 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.14 18/62] can: sja1000: force the string buffer NULL-terminated Date: Tue, 27 Aug 2019 09:50:23 +0200 Message-Id: <20190827072701.398701306@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@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