Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp586506ybg; Wed, 3 Jun 2020 08:29:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqacRGLBZs5z4CedkmHi2R3HbvYvoA+S1hC7TDWAE2UJJ+XQizddBqwOpRF7SxepPXvDm3 X-Received: by 2002:a05:6402:1a48:: with SMTP id bf8mr32495290edb.133.1591198169422; Wed, 03 Jun 2020 08:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591198169; cv=none; d=google.com; s=arc-20160816; b=Wv6fZdOrsPIfXtStUfCMnFKjIz4U8Lg4/YF9QHucGO75QwWTmuZ5rT34U+L9DoxDWG Ci9y7olRv3Jc+fHAtFMGXQplEoopT9bMxE8eEHD98gR1yPFb1TDaa6sY0v+5auKksm/3 w94ngsP/XdhVKTjgrxlKLZMqKvkRMaiI0Xe5NoIMCYDGdO/Yr2nByd81f/2PFyUwKME6 zO0zIWl81jPtoqBln72XXpbi5kAjEQ1jMyF4wDakQdhlkybgj3pra3MgCGV+eGNEasCj sbdMtEbPcf2iAJVK2CCPhXoHWie5xMGdzloL1IgoJL8UmJPmed93MHc/KqMFIa09JaU8 fUDA== 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 :message-id:date:subject:cc:to:from; bh=TI71EQkgRiykB9cwyrszJwVo6ai3Du0dG7EYNU5AcZI=; b=Cd1EMcsDAw09vwtWlXdBASmXV9maLzLfH8MkGGKtsiDoiY0qryJb7ClheHNARYlDnC t+AUJQSKMQqYOvvEL4xVqRCUReFKElNaPcG8aWyk9Cxt+Shlffjxgs3fqEjSLQmkasyy aXz6k0aiVHSNFYSIfG31Znl/nvnnl+M5eQn3BMycatlX6ZBV7RzkemLz9PZE9maWmbpe U701DZLRaoxrC1htcYLbekMP+i05cDns6yAVINmDYY+xAOXNpx/p6jun3A35QmwXuMNs z89UzDeW5dE0BoUXwLgZucGgjJmXGUaqZgqS2Rb8/f+oKKYbZtgNGnDFsajpJ/vySJWP JkQw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si1369366ejb.364.2020.06.03.08.29.06; Wed, 03 Jun 2020 08:29:29 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbgFCP1M (ORCPT + 99 others); Wed, 3 Jun 2020 11:27:12 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:46160 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725884AbgFCP1M (ORCPT ); Wed, 3 Jun 2020 11:27:12 -0400 Received: by mail-lj1-f196.google.com with SMTP id z9so3227833ljh.13 for ; Wed, 03 Jun 2020 08:27:09 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=TI71EQkgRiykB9cwyrszJwVo6ai3Du0dG7EYNU5AcZI=; b=M4uIXDVUSdq5ANUfBKmVm5ocnE8liOVPEmFPGw//8jRngmx8jFHniYOecZFXQmlMyH UOFwlcpXy/gHd/Nac58Tc/VAQwk6UaR1CREccbFFl3iiINrcMozfFxoL3jtwVHYeEqRO ILiskEAHxeTVvYjaSK1OOVr/N2/o32meJOpguhZ4SZDvvwE6bVYed+z2jWZZuLJkBSD2 eaCEXmAbGyF2wd9UleI3PYvPFjA8s2vi2O8LjLiLuCET2LKJv4bDv9Kq21SchO645jJM 6A1r5lIFJOH+BF5fqpPR1WtMLtp7u3YoFNpMs8WESZ/8WvJHoeHrN7b/iXeuso6+3d2p mp7Q== X-Gm-Message-State: AOAM531zYp2yPGWBWh4VBw7Ar42o/hRIMJicClxLAVJsGEomO1zFTxBM BZDyz19NwPDraoJ9VGf77vk= X-Received: by 2002:a2e:b8ce:: with SMTP id s14mr2196638ljp.89.1591198028574; Wed, 03 Jun 2020 08:27:08 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-38-130.ip.moscow.rt.ru. [37.110.38.130]) by smtp.googlemail.com with ESMTPSA id e21sm631714ljb.135.2020.06.03.08.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 08:27:07 -0700 (PDT) From: Denis Efremov To: "David S. Miller" Cc: Denis Efremov , Paul Durrant , Wei Liu , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: [PATCH] xen-netback: use kstrdup() in connect_data_rings() Date: Wed, 3 Jun 2020 18:26:43 +0300 Message-Id: <20200603152643.18215-1-efremov@linux.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kstrdup() instead of opencoded alloc and copy. kzalloc() is excessive here. Signed-off-by: Denis Efremov --- drivers/net/xen-netback/xenbus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 286054b60d47..69352154a51b 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c @@ -839,13 +839,12 @@ static int connect_data_rings(struct backend_info *be, * queue-N. */ if (num_queues == 1) { - xspath = kzalloc(strlen(dev->otherend) + 1, GFP_KERNEL); + xspath = kstrdup(dev->otherend, GFP_KERNEL); if (!xspath) { xenbus_dev_fatal(dev, -ENOMEM, "reading ring references"); return -ENOMEM; } - strcpy(xspath, dev->otherend); } else { xspathsize = strlen(dev->otherend) + xenstore_path_ext_size; xspath = kzalloc(xspathsize, GFP_KERNEL); -- 2.26.2