From patchwork Mon Jun 15 03:38:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 187921 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp2393485ilo; Sun, 14 Jun 2020 20:39:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPe22q9R8a3viLkUrTU3AV9MzedD4bKdWrqC7Ei9g3ABGNDbxCdPpZhfk7BMTCbH9i+B4U X-Received: by 2002:aa7:cb52:: with SMTP id w18mr22448817edt.1.1592192342394; Sun, 14 Jun 2020 20:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592192342; cv=none; d=google.com; s=arc-20160816; b=dA1MM8uMW9xtA6q6oYwtox3ja+6nC8LKvvBn75NSy+yivcOxRBlHt+EnPZacAxiTrH hMKJpQi1yO/y9BoMUB7dA4jGtAODnVeGENXLHTjvaFHQPd7D5e1KUktxU2+Jwy6DHs12 bh2TfqsDEEU06pyLAExdF5srv9qvmKCLPFAxFfir732AfNHZSDucnVqz9kvgLBk265qD ejwJ8I8q3HtQtzUYvtBPqxpRiheSXUhYDIw/2QW9w6OHPYdmfudenpej/OM8u2j7Jaf0 2+k3bJwZM2X6jzJu33OtqNGFkurvRUH4KK1zxPbjJfAD0kpGCbTfEbIyUMpYI7ZtxHLn JUlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HnHM3J+bDKwkRPdfs7jfYoRrpz30LWs87Ov1z3GBhfI=; b=bCfkAeRYfo4Q453kFuE0Au2GBcUV66MZEYdlNDlrPMXexENZDgpsF/qbxc8tRX/zsd SJnRXlUHSlWatpqQH9+lVafHm1itjS807OlK7UugqAeMmn65uyAjkdXHABOBTJxNGxAx iwVZNgyRZYc4+IgxZxBzIocKCT5UBlEZQkHzMOTeUDviuUeoItrWXl8tqNrvlfamFxnm uqb6iO1K72I21Yic8IbcEh4AvRiIQxZ2gPkakiVrltddmwaT0njkVBYq6ZkLeb0s0JUc 5NAZpplkQtx6L314gazNddEqh8X8YKpc8awXutjm4OfOUKu2nyoG4cj5eDvVZw2FKlq0 xnJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nqYVnyLc; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id np7si8199099ejb.377.2020.06.14.20.39.02; Sun, 14 Jun 2020 20:39:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nqYVnyLc; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728246AbgFODi5 (ORCPT + 1 other); Sun, 14 Jun 2020 23:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728244AbgFODiz (ORCPT ); Sun, 14 Jun 2020 23:38:55 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28B0DC05BD43 for ; Sun, 14 Jun 2020 20:38:54 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id d6so6480487pjs.3 for ; Sun, 14 Jun 2020 20:38:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HnHM3J+bDKwkRPdfs7jfYoRrpz30LWs87Ov1z3GBhfI=; b=nqYVnyLcncpBshp6K/Vh4ubGWmRgbjeBzNIWcgdqhvxVuCfSzUubHKnd1AeWrD6IwI NbLFVuDtT1gldAQxH8PTxYB0lVjscrK6dzdOohWawXEK6m1k+wAjV9NHoER0mO1YHeyd 8vrughnfDJI/BRDULro0zcZkJOBR/6wGnktIbEY6QDVwJRjHMYcAlMfQveeaJcvfb2Bu gn1lTCYrMKd5GxS7OQL7ABQd+RD+AJDny4rh464bk4ZvYBLLHs5ajMLzEbbUmrkDBdxz 0k/3EfBQ3KfJc6Q2uMViaJMaC9mRxYrsUSVrvewAVxZpj2VuNWJvVQIlznMoz6pGhraH TfQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HnHM3J+bDKwkRPdfs7jfYoRrpz30LWs87Ov1z3GBhfI=; b=ZBVUee/X+gyoVj/y4km2/BmUnKl9xi0UEeetxkyYIib8hAK1uNIgFsmNObd6mB1ulb KFoRh2U5JNYsTI+dcbLfzsW/Y/egWIUmqytW2450W2nZNWpTDr+ALLORAUhGkjNJ3SZu FADHdxri2todhyWxd/oOn5OS9sJ0zx8kFUfJ1TXectsRxKX8mSax5hLKWRBAFti31dab 7z+FFxCoWZ9PnoEps7weJt+OrfUjj+wycSfihAB+PRk/P6x++t0ENnDnPTQqLfWWuwJY C0FqFAeZQ2Q8QkpXhXs4/XGfEgsGSJrAwbHFp607N8VF+MSXnlPbhQuAfsr3GaKX3ILL 0i8Q== X-Gm-Message-State: AOAM532Qj7c7dGuFgCaOBp8M3ZwuiDHxAmcsjva9C49YFL6OEQNZl6Ho lbyJSNXsUF3DvD8FCXau9gQmyg== X-Received: by 2002:a17:90a:c257:: with SMTP id d23mr10008520pjx.103.1592192333625; Sun, 14 Jun 2020 20:38:53 -0700 (PDT) Received: from localhost.localdomain ([36.5.193.138]) by smtp.gmail.com with ESMTPSA id o22sm7525194pfd.114.2020.06.14.20.38.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jun 2020 20:38:53 -0700 (PDT) From: Zhangfei Gao To: =?utf-8?q?Herbert_Xu=C2=A0?= , =?utf-8?q?=C2=A0Greg_Kroah-Hartman?= =?utf-8?b?wqA=?= , =?utf-8?q?=C2=A0Eric_Biggers?= , =?utf-8?q?Jonathan_Cameron=C2=A0?= , =?utf-8?b?wqB3YW5nemhvdTHCoA==?= Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, kbuild-all@lists.01.org, Zhangfei Gao Subject: [PATCH v2] crypto: hisilicon - fix strncpy warning with strscpy Date: Mon, 15 Jun 2020 11:38:37 +0800 Message-Id: <1592192317-10566-1-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591241524-6452-1-git-send-email-zhangfei.gao@linaro.org> References: <1591241524-6452-1-git-send-email-zhangfei.gao@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Use strscpy to fix the warning warning: 'strncpy' specified bound 64 equals destination size Reported-by: kernel test robot Signed-off-by: Zhangfei Gao --- v2: Use strscpy instead of strlcpy since better truncation handling suggested by Herbert Rebase to 5.8-rc1 drivers/crypto/hisilicon/qm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.23.0 diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index 9bb263cec6c3..8ac293afa8ab 100644 --- a/drivers/crypto/hisilicon/qm.c +++ b/drivers/crypto/hisilicon/qm.c @@ -2179,8 +2179,12 @@ static int qm_alloc_uacce(struct hisi_qm *qm) .flags = UACCE_DEV_SVA, .ops = &uacce_qm_ops, }; + int ret; - strncpy(interface.name, pdev->driver->name, sizeof(interface.name)); + ret = strscpy(interface.name, pdev->driver->name, + sizeof(interface.name)); + if (ret < 0) + return -ENAMETOOLONG; uacce = uacce_alloc(&pdev->dev, &interface); if (IS_ERR(uacce))