Skip to content

Commit a73d4a0

Browse files
tobluxjgross1
authored andcommitted
drivers/xen/xenbus: Replace deprecated strcpy in xenbus_transaction_end
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: KSPP#88 Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20251031112145.103257-2-thorsten.blum@linux.dev>
1 parent 6fec913 commit a73d4a0

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

drivers/xen/xenbus/xenbus_xs.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,12 @@ int xenbus_transaction_start(struct xenbus_transaction *t)
546546
EXPORT_SYMBOL_GPL(xenbus_transaction_start);
547547

548548
/* End a transaction.
549-
* If abandon is true, transaction is discarded instead of committed.
549+
* If abort is true, transaction is discarded instead of committed.
550550
*/
551-
int xenbus_transaction_end(struct xenbus_transaction t, int abort)
551+
int xenbus_transaction_end(struct xenbus_transaction t, bool abort)
552552
{
553-
char abortstr[2];
554-
555-
if (abort)
556-
strcpy(abortstr, "F");
557-
else
558-
strcpy(abortstr, "T");
559-
560-
return xs_error(xs_single(t, XS_TRANSACTION_END, abortstr, NULL));
553+
return xs_error(xs_single(t, XS_TRANSACTION_END, abort ? "F" : "T",
554+
NULL));
561555
}
562556
EXPORT_SYMBOL_GPL(xenbus_transaction_end);
563557

include/xen/xenbus.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ int xenbus_exists(struct xenbus_transaction t,
158158
const char *dir, const char *node);
159159
int xenbus_rm(struct xenbus_transaction t, const char *dir, const char *node);
160160
int xenbus_transaction_start(struct xenbus_transaction *t);
161-
int xenbus_transaction_end(struct xenbus_transaction t, int abort);
161+
int xenbus_transaction_end(struct xenbus_transaction t, bool abort);
162162

163163
/* Single read and scanf: returns -errno or num scanned if > 0. */
164164
__scanf(4, 5)

0 commit comments

Comments
 (0)