Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9403833pxu; Mon, 28 Dec 2020 15:21:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5srols/UP6PW1vRlpd/uvSsz6yuHRPasCnduM8zblYW7B3fYT8Mza1IHB7uzq6E23GCSG X-Received: by 2002:a50:f307:: with SMTP id p7mr43668081edm.368.1609197705431; Mon, 28 Dec 2020 15:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609197705; cv=none; d=google.com; s=arc-20160816; b=uXDO2YRz4qC5ffFiIAQiMM+vmPx8hG1RlWBIJQQGrffNFOgjF1GbYtk1+6TLOCL11M rTmaYqED/fNrFlI0Qz7yrAVdrgJ8q3MJfJCgvuXndq5J9OB9+RJkmEy9fRw3TQOyb34N QB45T1hwHRgv0klUZk+4KRBY8uSn/aTYefxwQTnBzt4PoqWA2iYFC4fB1uXxs8l8GWwT /Fiq3ILHfr3Wl3eOl2UWV9DTc85gmz/aIOSTMGvIMU4vk3iTnwGbop1CGQ3uLVf1qkXz S8hojQvh4l/CVaMqKp1CfFRDZhoWPba5HIF0V3zPm0OV4Ecb9povjYV9yllgCdE9R6Q+ XxqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c1XVjP57CQGDS8Sorlel6zNuK5v4CqIfrCldp9fJEHg=; b=0zdlS/m4F8mEgvLYY+qpP2teND/o5xcn2l29qnZMz2PPZktEsrV9eZZ8AIR2q3P29Y VbrMLVSxJu3VU/HSvesbGeDQIRyuOI1+JkzYdYoUwdCRHRZRt/Jh4B8SKBaaqehVdVpK RwHDf7MN54Ut/fTyYnhN21/hbYnClTuljcXP/qIZVa2fG2QW5nu4WUDLcJQuYs2AmoYh wi674+JVOZP6etcdOo/7nXfpDJgP8uMd2lUHdFsHDYfXi9R82labGK5ZN/OJe1Ukuhuj r6fPaNAYGHxpCz7twES0Sppb8TgI8pN8Iqty8IdLTGl8YlI28xsPOV3FPzyZ8bA8fWuF tZww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oCfrdj1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt1si21610565ejc.558.2020.12.28.15.21.23; Mon, 28 Dec 2020 15:21:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=oCfrdj1r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502234AbgL1OVl (ORCPT + 99 others); Mon, 28 Dec 2020 09:21:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:56064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502427AbgL1OVQ (ORCPT ); Mon, 28 Dec 2020 09:21:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1004B22B2C; Mon, 28 Dec 2020 14:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165260; bh=b0jcMGLxfRGb7TrSxt2oYTfuWtuHkhr6KAf1Dqypw7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oCfrdj1r/sRWoqNd1dcNR1OcziFO4alxnNTwz8c3CIoyhpnV9maiXhCoCAPFxrOv9 9lY4WNxX/p9nWg+zR/cf3fhtS4PYEjAE/dO1Bhh8ad0PV3r7lnMPLxpu33CYjiHDre U2LtrtTd4fQsXDrDhr+NMGMGJh8GAp7F+l0VStIs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Md Haris Iqbal , Jack Wang , Jens Axboe , Sasha Levin Subject: [PATCH 5.10 469/717] block/rnbd-clt: Get rid of warning regarding size argument in strlcpy Date: Mon, 28 Dec 2020 13:47:47 +0100 Message-Id: <20201228125043.440779235@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Md Haris Iqbal [ Upstream commit e7508d48565060af5d89f10cb83c9359c8ae1310 ] The kernel test robot triggerred the following warning, >> drivers/block/rnbd/rnbd-clt.c:1397:42: warning: size argument in 'strlcpy' call appears to be size of the source; expected the size of the destination [-Wstrlcpy-strlcat-size] strlcpy(dev->pathname, pathname, strlen(pathname) + 1); ~~~~~~~^~~~~~~~~~~~~ To get rid of the above warning, use a kstrdup as Bart suggested. Fixes: 64e8a6ece1a5 ("block/rnbd-clt: Dynamically alloc buffer for pathname & blk_symlink_name") Reported-by: kernel test robot Signed-off-by: Md Haris Iqbal Signed-off-by: Jack Wang Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/rnbd/rnbd-clt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c index f180ebf1e11c9..7af1b60582fe5 100644 --- a/drivers/block/rnbd/rnbd-clt.c +++ b/drivers/block/rnbd/rnbd-clt.c @@ -1383,12 +1383,11 @@ static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess, goto out_queues; } - dev->pathname = kzalloc(strlen(pathname) + 1, GFP_KERNEL); + dev->pathname = kstrdup(pathname, GFP_KERNEL); if (!dev->pathname) { ret = -ENOMEM; goto out_queues; } - strlcpy(dev->pathname, pathname, strlen(pathname) + 1); dev->clt_device_id = ret; dev->sess = sess; -- 2.27.0