Skip to contentSkip to conversation

xen/xenbus: Remove BUG_ON() when error string trucated

PATCH Applied Chen Gang 2 participants 3 messages Sep 26, 2014 Xen hypervisor interface

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH v3 1/1 xen/xenbus: Remove BUG_ON() when error string trucated

xenbus_va_dev_error() is for printing error, so when error string is too long to be truncated, need not BUG_ON(), still return truncation string is OK.

---
 drivers/xen/xenbus/xenbus_client.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/xen/xenbus/xenbus_client.c +1 -4
index aa9b2fc..ca74410 100644
@@ -259,7 +259,6 @@ static char *error_path(struct xenbus_device *dev)
 static void xenbus_va_dev_error(struct xenbus_device *dev, int err,
 				const char *fmt, va_list ap)
 {
-	int ret;
 	unsigned int len;
 	char *printf_buffer = NULL;
 	char *path_buffer = NULL;
@@ -270,9 +269,7 @@ static void xenbus_va_dev_error(struct xenbus_device *dev, int err,
 		goto fail;
 
 	len = sprintf(printf_buffer, "%i ", -err);
-	ret = vsnprintf(printf_buffer+len, PRINTF_BUFFER_SIZE-len, fmt, ap);
-
-	BUG_ON(len + ret > PRINTF_BUFFER_SIZE-1);
+	vsnprintf(printf_buffer+len, PRINTF_BUFFER_SIZE-len, fmt, ap);
 
 	dev_err(&dev->dev, "%s\n", printf_buffer);
 
Signature · 1 line
1.9.3
Applied
#1 lore raw
Quoted 3 lines · Chen Gang

xenbus_va_dev_error() is for printing error, so when error string is too long to be truncated, need not BUG_ON(), still return truncation string is OK.

Applied to devel/for-linus-3.18

Thanks.

David

Applied
#2 lore raw
In reply to Chen Gang
Quoted 3 lines · Chen Gang

xenbus_va_dev_error() is for printing error, so when error string is too long to be truncated, need not BUG_ON(), still return truncation string is OK.

Applied to devel/for-linus-3.18

Thanks.

David