From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7FBA841E77 for ; Fri, 17 Mar 2023 02:43:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 759CB40DFD; Fri, 17 Mar 2023 02:43:20 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id BF61D40A79; Fri, 17 Mar 2023 02:43:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679017398; x=1710553398; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=hE4/mroGj6m7hF0b8LPbhF13Qk9mi16I3D0hqY2pm3w=; b=l7gMcDGiuT/Eya11RBONlOAjHQJTJKIwYSyqnUMO+Q7obJux4gJzh9nu luNFSBDulNvH2XKaKx4t60sksu9ya/59vvJUyul28x2xySB/8zmPf3glQ jaiDm6ujL3TLDZij8i1/Mmu5ZtglOGiuEkziLh+5xsRxu6XJ4Tn1OqucF MOo7MSNxd0rssF7NwhrEG4JUbL0P2DiQm8YWP4d6nDu/jC9QqJRynsYR9 QpbY42hA8ReDQq+WpVH/hJPW26ZZSBszJf8q4zq/J6ywA+vy4XfMRfn7C ESMIV/NUvbdRq6ByKHM8+dAr7jiCNjAyGqLQgQr3RwhLe8PKsgOTaw2ra Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10651"; a="339698131" X-IronPort-AV: E=Sophos;i="5.98,267,1673942400"; d="scan'208";a="339698131" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2023 18:43:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10651"; a="744387767" X-IronPort-AV: E=Sophos;i="5.98,267,1673942400"; d="scan'208";a="744387767" Received: from sh_lab5_1.sh.intel.com (HELO ocsbesrhlrepo01.sh.intel.com) ([10.238.175.110]) by fmsmga008.fm.intel.com with ESMTP; 16 Mar 2023 18:43:14 -0700 From: Wei Huang To: dev@dpdk.org, thomas@monjalon.net, david.marchand@redhat.com Cc: stable@dpdk.org, rosen.xu@intel.com, tianfei.zhang@intel.com, qi.z.zhang@intel.com, Wei Huang Subject: [PATCH v1] bus/ifpga: fix issue of accessing null address Date: Thu, 16 Mar 2023 16:44:12 -0400 Message-Id: <20230316204412.338823-1-wei.huang@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org In function ifpga_scan_one(), variable 'path' is NULL if device argument 'afu_bts' is not set, subsequent string copy with 'path' would lead to segmentation fault. Fixes: 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs") Cc: stable@dpdk.org Signed-off-by: Wei Huang --- drivers/bus/ifpga/ifpga_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index bb943b5..07e316b 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -135,6 +135,8 @@ struct rte_afu_device * goto end; } afu_pr_conf.pr_enable = 1; + strlcpy(afu_pr_conf.bs_path, path, + sizeof(afu_pr_conf.bs_path)); } else { afu_pr_conf.pr_enable = 0; } @@ -174,7 +176,6 @@ struct rte_afu_device * rawdev->dev_ops->dev_start(rawdev)) goto end; - strlcpy(afu_pr_conf.bs_path, path, sizeof(afu_pr_conf.bs_path)); if (rawdev->dev_ops && rawdev->dev_ops->firmware_load && rawdev->dev_ops->firmware_load(rawdev, -- 1.8.3.1