Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4722275rwb; Tue, 20 Sep 2022 19:30:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hE4mtLxqlPGiadZq5evItKLPqF0ipH9Pcq5XegyzcqjTUzYuVZ03zAE78mFifW8rmmEVv X-Received: by 2002:a17:907:6d28:b0:781:c4a3:4a08 with SMTP id sa40-20020a1709076d2800b00781c4a34a08mr4644850ejc.280.1663727445206; Tue, 20 Sep 2022 19:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663727445; cv=none; d=google.com; s=arc-20160816; b=Uv9mKr1I4Vtbzahh0S1LkwyL8bLuJVgnxpDPzrfthQMkE4+vzWAkHodRtwavOcGQQd ntn7gqmLO2Jnzu8y9pAeoxDo2S7Boht38MhQfksQia4cb7QtT9I5dgkGhuRHmggoXei1 CjS9onD3yrSUjdyy6cgQP4qURXHm9v2ajyiALC268mwXX9314Gy/gIDGkedgqqqQCWrS Zh7xF7pRHMfOkHdi6sM+dyGIziMtR/SUCZqHNt9j9qa7ptOnQDVfVWnMOxmJAxZw9KIl JFHssyPMiVPV3lDyGexUauXQP1Z3frH7WiP3Pb0uBrl3Y4efvr7Ap84OSw1IQKqpthWo 3rmg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=GnHGtgHj033COJKahffZStPIaXE02OICjJM2Z9aEkfE=; b=HC6Uw5juZc4bYmePxKM7E3xVZhL6FEAzqcgs7ssxUA0lMg3wEqH0HKzkflVrITnOP8 qsWerEjjvFY1ZQ8glDF01Qr9b3jiPWFRGpdxM/x4lmWeh0zVsc0/vCWc0HrIBZo9JIm5 pQEOUOSr9H8mutRnOhx6/Q2bOVEVtFji4kYrfhCmct5FsCsrqQwXSx+ZioQh48Lgvqhj UZNwX6WAxLVtf27cBnK3h5f93+5kUpJkS7fKwQ891d7Z76e3pS4Q9GQNIgwB6PBBHven q1W70mfL0I2rAKcnJJtnbfzhzO4C0raSO0r0A024IqumkUsY+n/H9woSsywFcKcVqtS2 sSoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ArRr74et; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr11-20020a170907720b00b0077073b26373si1298902ejc.426.2022.09.20.19.30.17; Tue, 20 Sep 2022 19:30:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ArRr74et; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbiIUCQl (ORCPT + 99 others); Tue, 20 Sep 2022 22:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229916AbiIUCQZ (ORCPT ); Tue, 20 Sep 2022 22:16:25 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA07032BBD; Tue, 20 Sep 2022 19:16:24 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id q9-20020a17090a178900b0020265d92ae3so12697553pja.5; Tue, 20 Sep 2022 19:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=GnHGtgHj033COJKahffZStPIaXE02OICjJM2Z9aEkfE=; b=ArRr74et4U1zLmXiJOghTrTMnedfdbF7K14oBBpNIc8qTkREGPO5v04fI1k1kbyrLx aE9AvyteVh2+qhO2Mdb8OF0GMzIxHqqYA7AHgEMHz8m3ZBG0PwqpaX4uoFIQTg10zUkz MwCcQnpBOkDxcL5Yt6/9QvFFjyx7CVdOExmelt+4nQuFpw3m7saN/EepKWFmT1xTW4Wv coNsRQJPCjqBxC2R2jbd/LOVOzubUoQ1Gm37yLcX/MfefYirEknZw/ktLHoEDM/P0J76 fX0JWbhPys/CYrKJKqNQ6liKGabibcgJBuAF6GH29Vno10Zq+ui/epuVMeLTYcPMphfm nFIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=GnHGtgHj033COJKahffZStPIaXE02OICjJM2Z9aEkfE=; b=FqsWxyFbqZh31KikU2paLSCkMoltWCG88nEBnr+veg4oG3rlHOEi9VYqUi8hcJ7gQE TqsO5HgtFx9wvSAadjO6hwGx2HX4rx4W0ykrMmzDRFiXwsIKsBARhKqpvIsdjLdmgNfs g6cO0uLYrG/lwlSF4yaOe9VrKYbq+VUBeee/3jb3jo02cT9TXYf40Y7DNzBJPxiz+sgs aMoGxXXKEjgnV0VxskRcMKScne5Ns0dRSQRCF8ejrBb+nWvIju0zQncEDHJkz3fQzZxl 6lPyfqN7EuBBDcG7iYJcFzdCXG3LJclHy/SJ59AVwuljwDa/5Jok25tccVbRf85MwPhM bTqQ== X-Gm-Message-State: ACrzQf0cOirRQpdL/elru0rT3PdPnayyzHAZS1UCmDyTvfGftqtdaQU0 YhVUP0KxzYMWmzRTrm3STD8= X-Received: by 2002:a17:90a:8909:b0:203:ab27:a41 with SMTP id u9-20020a17090a890900b00203ab270a41mr7073542pjn.163.1663726584165; Tue, 20 Sep 2022 19:16:24 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id y1-20020a623201000000b0053e9ecf58f0sm661954pfy.20.2022.09.20.19.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 19:16:23 -0700 (PDT) From: cgel.zte@gmail.com X-Google-Original-From: chi.minghao@zte.com.cn To: wei.liu@kernel.org Cc: paul@xen.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, xen-devel@lists.xenproject.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Minghao Chi , Zeal Robot Subject: [PATCH] xen-netback: use kstrdup instead of open-coding it Date: Wed, 21 Sep 2022 02:16:17 +0000 Message-Id: <20220921021617.217784-1-chi.minghao@zte.com.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minghao Chi use kstrdup instead of open-coding it. Reported-by: Zeal Robot Signed-off-by: Minghao Chi --- 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 e85b3c5d4acc..c1ba4294f364 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c @@ -865,13 +865,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.25.1