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 71A6845EF1; Fri, 20 Dec 2024 02:53:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3FACE40267; Fri, 20 Dec 2024 02:53:43 +0100 (CET) Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11020104.outbound.protection.outlook.com [52.101.128.104]) by mails.dpdk.org (Postfix) with ESMTP id 7AF4340144 for ; Fri, 20 Dec 2024 02:53:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kJSi5IABh27TzoTq69nRHuUdLuumeGb2DaTjmI+Ioxdn23APMFzwK/6coPogrXKZ1JJU4bZdO1vVw7QSEDkmDujcHTycEESWQsTGtHP4rU5junCArshiqYkTY4LIRfavIHrSl7g+R6YPZeoDo9vU3bLtEMhc96eDeZzVum8qauIBKkaKt3fNHSnirWMbBDuS1kwAHC/L+9RFge1zyVaANASIKhxG8A5rkIe/HjZ5WJlBZtx1I51cbDVHGcWrUwGNfrYcHi0zkuQZPDzNepi63AZn3vUTxMPjB2gOiH1bwWG8bNsjKTEwn6ccyy2SuSBBzeERE5Dqz2wUAtbHsVIKLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lLUUSJZaJcDZo6GKBmJfCBNKfVeC3q6yuQIfcbNoBK4=; b=PhOxas7WuRkv0ppO0PT3gH3Wlz5WRfDIGR6nO47clAw/Cau0eGQLC6mX2RstnoFqFUYyrF+LHxLPoqx9kRFEVVzAIpCd46ccGFiU/FyWcEH/g8D8qW+Xg9f+SZdX1bGCLwYdrAADGFIXPn2CWSld2pye6D6JN9GRr9lCdBrd3SOarKX2XjWMQqvpZsJ8V3l+zXOsmS89Ha5c2c/loGR6Zm9Z1wdfcvsNfA2zHfU/8BGALq5NBxwbdIxH7zocW+25XD/pOT0IDEehB8evgSqj05/t2zjlWl8ONwX4Z7xFxCejpRl60NRCztlFvb6zxqEaD6rX8QuScQwR9DML7pL8DA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=jaguarmicro.com; dmarc=pass action=none header.from=jaguarmicro.com; dkim=pass header.d=jaguarmicro.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jaguarmicro.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lLUUSJZaJcDZo6GKBmJfCBNKfVeC3q6yuQIfcbNoBK4=; b=FoTBAHIdfmx7jbLSczhlibkRQPqWzq/RBYcEN6B/9DOHhgPk8KeAiCyrUlaXtICXCmbFhp6M+bL8W0wqn8NJgDxFw9Y3L/oXVKqTQiNtyACnHJXCqyxgvsIN2YQp1Fj05yQoVVblBy3kTOzYpwxpX0iZrkQ326Ug4Ti9/rNqFhtBnytjx/Y/oog/3yMJ0G2sm36yEIx8gNsJ+R8w2aaAHNRZEofABnHO0ToxT3//I6/Rr1NMwa3+b9bmg4d/uAcC1HFJLolwKSZuF3y59WvOdlElltbytk5s8pQzIbuHsj+qvYjl77uLbpn+GoA6q+oLXTJdcC+Utn8R7A5fHzycXA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=jaguarmicro.com; Received: from KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) by PUZPR06MB5936.apcprd06.prod.outlook.com (2603:1096:301:11d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8293.7; Fri, 20 Dec 2024 01:53:37 +0000 Received: from KL1PR0601MB5567.apcprd06.prod.outlook.com ([fe80::3ad3:b4d9:7e69:85cb]) by KL1PR0601MB5567.apcprd06.prod.outlook.com ([fe80::3ad3:b4d9:7e69:85cb%7]) with mapi id 15.20.8272.005; Fri, 20 Dec 2024 01:53:36 +0000 From: Sunyang Wu To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, chenbox@nvidia.com Subject: [PATCH] net/virtio: check return value when calling pthread_mutex_init Date: Fri, 20 Dec 2024 09:53:26 +0800 Message-Id: <20241220015326.36760-1-sunyang.wu@jaguarmicro.com> X-Mailer: git-send-email 2.19.0.rc0.windows.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SGAP274CA0024.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::36) To KL1PR0601MB5567.apcprd06.prod.outlook.com (2603:1096:820:c5::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: KL1PR0601MB5567:EE_|PUZPR06MB5936:EE_ X-MS-Office365-Filtering-Correlation-Id: 402176dd-967d-4af8-c552-08dd20991e3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wjIWZeZzzuI8Hz7qMwRlfiruod0c2dnLlEOgCqgAfhedhmTzB6VVLojcB57C?= =?us-ascii?Q?7G/dTlvV5JrES4xBbV6a5vMfia8hARAlesAVnodH+UbaNdk+p2+Mb2JaJ8s3?= =?us-ascii?Q?SBY0ZE9UlLBiGO39icWo07BCFpPq8cdwB9csJqbuPIomWvHXu8IyA5gGtHTc?= =?us-ascii?Q?FUbBvQrFule3vlX08ggOYZ1EyzJ9Y5VrB7ftcSchrGQVM5ZKDvxh1uOC75KA?= =?us-ascii?Q?KJ4bh0tJmf56ejIXQxEs3L9d+lTgjQ+vcwNpqBkY1T5s2UzG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5aBakRCAlBE9i/XXut98+wVyeoaY8w7FAvnBko?= =?us-ascii?Q?c4f9LP3lWUuXzb0D0V939iLlJ60lBEby8Q2Sv5P+SFe97Dh26MT8EdHptUU1?= =?us-ascii?Q?GxCxEXq0GMMSFOoxR0f0Q3QPRSlxouKbYg1H8/uqdfurvEuXVwXSxULfM/2t?= =?us-ascii?Q?IgZ2LM4J0P+eMr8X7mhukh/YuJUsntQ0klAWjms3IPopp0MIOflRD7eFB9GN?= =?us-ascii?Q?jV6JzjaorA09YD+PLaEKK9hP9wtdJ8PU5GKhd2ZA2vSDah9JiK36C5e6BRK7?= =?us-ascii?Q?W0yKODsEMVFDit04iaIN0OeYoG+1oL5O?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:KL1PR0601MB5567.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?qSwaGSQIzTSb6deZuDvyc1HTtJMBWBlJZOJ2gSNQM+6PTDJGbzE4Zo4bY56g?= =?us-ascii?Q?cuIiTko3+igwpTcNYi2wWuBRjuUwk5N5RVDOC3hHmkhTgfFksyOpzjPbg824?= =?us-ascii?Q?CZ/EhGjgCHDxEg82oNzDI1gR5uygtRo1HyzLevAlRV2UlZUdJJElp6rd/xQz?= =?us-ascii?Q?GZ2IUhIGabte+0go+PKQ7W+uZVo7X1zXYo1O6sN5J4ynCSxEUTM25WMYYJ+q?= =?us-ascii?Q?XKW/6CThL75/pI9mo2JSuJ4LLVG2VNS4rQtWcVGLrDOheONQngwhqaX3vHS4?= =?us-ascii?Q?y8NleBU2pC0PQYlyCYrPR0M5o7//3RYEWjEpqTlv8v8K7SW1K8OGmiDXglkG?= =?us-ascii?Q?B+OQRUFWPG8EX9GQ1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?us-ascii?Q?sggxzJpHQgphmDzVnQqFBL3j708f+Le+C/ZbhYDGEQw+GQ1+7ULHBesxSJ0d?= =?us-ascii?Q?D4EwzSRKKiNSBENQSq9oFFjf12gL9feXm/eM4cIPzp7CclXDnK4ZOShlIDrA?= =?us-ascii?Q?yDyS46Jdzh/VVBr1gW9PVo588Z1XEnqy3WlorYRx+SIaRIr0/iL1ZsqPI65H?= =?us-ascii?Q?+MxM9luGcYqg5/t+8qplRTbSQlaxVNIIRbt4if7VOJ/vSkkXaHWmJCW4DI2C?= =?us-ascii?Q?axTmihGrkBndosopoKsnrcxnVXCEjd3qRN4BsmBv84S2LuP5VX5p29bNkbJA?= =?us-ascii?Q?E4RSXpVlcV84DwEoxb4/vPgrTeosvAqnaa49U+oGk6pbWQxSMspKzYvpS4qs?= =?us-ascii?Q?9Q=3D=3D?= X-OriginatorOrg: jaguarmicro.com X-MS-Exchange-CrossTenant-Network-Message-Id: 402176dd-967d-4af8-c552-08dd20991e3c X-MS-Exchange-CrossTenant-AuthSource: KL1PR0601MB5567.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2024 01:53:36.7839 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 1e45a5c2-d3e1-46b3-a0e6-c5ebf6d8ba7b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: U3TNVVHPOKpw8rtJ0ZMb+/wz8m1FO+xHNW4rSGPeN2znv5fU+asJSp3EvG8OV2iKdn+7ybMuWirZsnuqJwjQDnIwnUQYzR6UhCkmjv1bhIQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB5936 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add validation for the return value of the pthread_mutex_init. Signed-off-by: Sunyang Wu --- drivers/net/virtio/virtio_user/virtio_user_dev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 2997d2bd26..00272cf802 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -735,8 +735,13 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues, enum virtio_user_backend_type backend_type) { uint64_t backend_features; + int ret; - pthread_mutex_init(&dev->mutex, NULL); + ret = pthread_mutex_init(&dev->mutex, NULL); + if (ret) { + PMD_INIT_LOG(ERR, "(%s) init dev mutex failed", dev->path); + return ret; + } strlcpy(dev->path, path, PATH_MAX); dev->started = 0; -- 2.19.0.rc0.windows.1