All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: at91: add a sanity check on i2c message length
@ 2012-10-10 14:25 ` ludovic.desroches at atmel.com
  0 siblings, 0 replies; 16+ messages in thread
From: ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w @ 2012-10-10 14:25 UTC (permalink / raw)
  To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA
  Cc: nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w, Ludovic Desroches

From: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>

If the i2c message length is zero, i2c-at91 will directly return an error
instead of trying to send a zero-length message.

Signed-off-by: Ludovic Desroches <ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---

fix for 3.7

 drivers/i2c/busses/i2c-at91.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index aa59a25..eaddc77 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -263,6 +263,9 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num)
 	unsigned int_addr_flag = 0;
 	struct i2c_msg *m_start = msg;
 
+	if (!msg->len)
+		return -EINVAL;
+
 	dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);
 
 	/*
-- 
1.7.11.3

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

end of thread, other threads:[~2012-11-05  6:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 14:25 [PATCH] i2c: at91: add a sanity check on i2c message length ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w
2012-10-10 14:25 ` ludovic.desroches at atmel.com
2012-10-24 14:34 ` ludovic.desroches
2012-10-24 14:34   ` ludovic.desroches
     [not found] ` <1349879158-27268-1-git-send-email-ludovic.desroches-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-11-01 22:29   ` Wolfram Sang
2012-11-01 22:29     ` Wolfram Sang
2012-11-02 11:04     ` ludovic.desroches
2012-11-02 11:04       ` ludovic.desroches
     [not found]       ` <5093A8CD.60006-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-11-02 11:14         ` Wolfram Sang
2012-11-02 11:14           ` Wolfram Sang
2012-11-02 16:00           ` ludovic.desroches
2012-11-02 16:00             ` ludovic.desroches
     [not found]             ` <5093EE2B.8080005-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2012-11-03 14:16               ` Wolfram Sang
2012-11-03 14:16                 ` Wolfram Sang
2012-11-05  6:08               ` Voss, Nikolaus
2012-11-05  6:08                 ` Voss, Nikolaus

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.