public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] xen/xenbus: Remove BUG_ON() when error string trucated
@ 2014-09-26 15:36 Chen Gang
  2014-09-26 18:08 ` David Vrabel
  0 siblings, 1 reply; 2+ messages in thread
From: Chen Gang @ 2014-09-26 15:36 UTC (permalink / raw)
  To: David Vrabel; +Cc: xen-devel, linux-kernel@vger.kernel.org

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.

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 drivers/xen/xenbus/xenbus_client.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
index aa9b2fc..ca74410 100644
--- a/drivers/xen/xenbus/xenbus_client.c
+++ b/drivers/xen/xenbus/xenbus_client.c
@@ -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);
 
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] xen/xenbus: Remove BUG_ON() when error string trucated
  2014-09-26 15:36 [PATCH v3] xen/xenbus: Remove BUG_ON() when error string trucated Chen Gang
@ 2014-09-26 18:08 ` David Vrabel
  0 siblings, 0 replies; 2+ messages in thread
From: David Vrabel @ 2014-09-26 18:08 UTC (permalink / raw)
  To: Chen Gang; +Cc: xen-devel, linux-kernel@vger.kernel.org

On 26/09/14 16:36, Chen Gang wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-26 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-26 15:36 [PATCH v3] xen/xenbus: Remove BUG_ON() when error string trucated Chen Gang
2014-09-26 18:08 ` David Vrabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox