From nobody Wed Dec 17 03:44:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linux.dev ARC-Seal: i=1; a=rsa-sha256; t=1761909786; cv=none; d=zohomail.com; s=zohoarc; b=e0RoJkJFPpwgHCBXpTxp3W734VEZwTe15yH6hJtwXdd2EQTKlPFwXUHmT9xA6oLukDwyGhvWDNe9r2CmNfmvPQFTXXtHtfmcHbTiGM5dlbY3N58znylNP4dYDBBKHyfmCW8d7ntiFFkfnDWCa5R2TKMTFxYrEF1xNsDft1Xp14c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761909786; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nyjzKpu22Trt/0gzyWsVXEu/Jh7s7rdQVLQems4ZlKQ=; b=W7Hh5h0gnWl6IZodg3IieUayCsB6ZHgMj3rDiIfLuvqFuuZ3TIKWmGWsZXPAZ3faCzy7wTmkBR7Nk0+bU8dq7SRw7LzBGwOArwhHQxAYwD5V/nDRXdoZ+VAUjgcdp9y3XM25t0XC72InAukfAk6MPJLOFRU/Y9OlsV1raKRPMeI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1761909786259664.4557484087165; Fri, 31 Oct 2025 04:23:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1154187.1484285 (Exim 4.92) (envelope-from ) id 1vEnDG-0004K7-9M; Fri, 31 Oct 2025 11:22:34 +0000 Received: by outflank-mailman (output) from mailman id 1154187.1484285; Fri, 31 Oct 2025 11:22:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vEnDG-0004K0-5b; Fri, 31 Oct 2025 11:22:34 +0000 Received: by outflank-mailman (input) for mailman id 1154187; Fri, 31 Oct 2025 11:22:32 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vEnDE-0004Ju-27 for xen-devel@lists.xenproject.org; Fri, 31 Oct 2025 11:22:32 +0000 Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [2001:41d0:203:375::b5]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e2e577ca-b64b-11f0-9d16-b5c5bf9af7f9; Fri, 31 Oct 2025 12:22:30 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e2e577ca-b64b-11f0-9d16-b5c5bf9af7f9 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1761909748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nyjzKpu22Trt/0gzyWsVXEu/Jh7s7rdQVLQems4ZlKQ=; b=TJxTgbNAv6VQC/hclzu8aspYLQyOkrXQZO59TNSwY65Pe4LtclsZA/dkNjOxHW9lsO/Ia1 2OLlRAqRn94pA94cVA1jijQmAdVFm8V8jNTYin0Qjy9afBu8cDrxvLaU0aJ8+vyAh+kQ7e 6DXvLLY2U7vmg9GDTWFZ0H8BfGkuoQE= From: Thorsten Blum To: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Jason Andryuk , "Dr. David Alan Gilbert" , Thorsten Blum Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 RESEND] drivers/xen/xenbus: Replace deprecated strcpy in xenbus_transaction_end Date: Fri, 31 Oct 2025 12:21:31 +0100 Message-ID: <20251031112145.103257-2-thorsten.blum@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-ZohoMail-DKIM: pass (identity @linux.dev) X-ZM-MESSAGEID: 1761909788071158500 strcpy() is deprecated; inline the read-only string instead. Fix the function comment and use bool instead of int while we're at it. Link: https://github.com/KSPP/linux/issues/88 Reviewed-by: Juergen Gross Signed-off-by: Thorsten Blum --- Changes in v2: - Use an inline ternary expression and remove 'char abortstr[2]' as suggested by J=C3=BCrgen - Link to v1: https://lore.kernel.org/lkml/20251012195514.39003-2-thorsten.= blum@linux.dev/ --- drivers/xen/xenbus/xenbus_xs.c | 14 ++++---------- include/xen/xenbus.h | 2 +- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 528682bf0c7f..5d95a5f83119 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c @@ -546,18 +546,12 @@ int xenbus_transaction_start(struct xenbus_transactio= n *t) EXPORT_SYMBOL_GPL(xenbus_transaction_start); =20 /* End a transaction. - * If abandon is true, transaction is discarded instead of committed. + * If abort is true, transaction is discarded instead of committed. */ -int xenbus_transaction_end(struct xenbus_transaction t, int abort) +int xenbus_transaction_end(struct xenbus_transaction t, bool abort) { - char abortstr[2]; - - if (abort) - strcpy(abortstr, "F"); - else - strcpy(abortstr, "T"); - - return xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL)); + return xs_error(xs_single(t, XS_TRANSACTION_END, abort ? "F" : "T", + NULL)); } EXPORT_SYMBOL_GPL(xenbus_transaction_end); =20 diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index 7dab04cf4a36..c94caf852aea 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -158,7 +158,7 @@ int xenbus_exists(struct xenbus_transaction t, const char *dir, const char *node); int xenbus_rm(struct xenbus_transaction t, const char *dir, const char *no= de); int xenbus_transaction_start(struct xenbus_transaction *t); -int xenbus_transaction_end(struct xenbus_transaction t, int abort); +int xenbus_transaction_end(struct xenbus_transaction t, bool abort); =20 /* Single read and scanf: returns -errno or num scanned if > 0. */ __scanf(4, 5) --=20 2.51.1