public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] char: xillybus: Fix internal data structure initialization
@ 2016-02-23 11:41 Eli Billauer
  2016-02-23 15:22 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Billauer @ 2016-02-23 11:41 UTC (permalink / raw)
  To: arnd, gregkh; +Cc: linux-kernel, Eli Billauer


Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
---
 drivers/char/xillybus/xillybus_core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c
index 77d6c12..dcd19f3 100644
--- a/drivers/char/xillybus/xillybus_core.c
+++ b/drivers/char/xillybus/xillybus_core.c
@@ -509,7 +509,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
 			channel->log2_element_size = ((format > 2) ?
 						      2 : format);
 
-			bytebufsize = channel->rd_buf_size = bufsize *
+			bytebufsize = bufsize *
 				(1 << channel->log2_element_size);
 
 			buffers = devm_kcalloc(dev, bufnum,
@@ -523,6 +523,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
 
 		if (!is_writebuf) {
 			channel->num_rd_buffers = bufnum;
+			channel->rd_buf_size = bytebufsize;
 			channel->rd_allow_partial = allowpartial;
 			channel->rd_synchronous = synchronous;
 			channel->rd_exclusive_open = exclusive_open;
@@ -533,6 +534,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
 						   bufnum, bytebufsize);
 		} else if (channelnum > 0) {
 			channel->num_wr_buffers = bufnum;
+			channel->wr_buf_size = bytebufsize;
 
 			channel->seekable = seekable;
 			channel->wr_supports_nonempty = supports_nonempty;
-- 
1.7.2.3

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

* Re: [PATCH] char: xillybus: Fix internal data structure initialization
  2016-02-23 11:41 [PATCH] char: xillybus: Fix internal data structure initialization Eli Billauer
@ 2016-02-23 15:22 ` Greg KH
  2016-02-23 15:35   ` Eli Billauer
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-02-23 15:22 UTC (permalink / raw)
  To: Eli Billauer; +Cc: arnd, linux-kernel

On Tue, Feb 23, 2016 at 01:41:28PM +0200, Eli Billauer wrote:
> 
> Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
> ---
>  drivers/char/xillybus/xillybus_core.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)

I can't accept patches without any changelog information :(

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

* Re: [PATCH] char: xillybus: Fix internal data structure initialization
  2016-02-23 15:22 ` Greg KH
@ 2016-02-23 15:35   ` Eli Billauer
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Billauer @ 2016-02-23 15:35 UTC (permalink / raw)
  To: Greg KH; +Cc: arnd, linux-kernel

Oops. Didn't know it was required.

I'll resubmit this patch soon. Sorry.

Eli

On 23/02/16 17:22, Greg KH wrote:
> On Tue, Feb 23, 2016 at 01:41:28PM +0200, Eli Billauer wrote:
>    
>> Signed-off-by: Eli Billauer<eli.billauer@gmail.com>
>> ---
>>   drivers/char/xillybus/xillybus_core.c |    4 +++-
>>   1 files changed, 3 insertions(+), 1 deletions(-)
>>      
> I can't accept patches without any changelog information :(
>
>    

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

* [PATCH] char: xillybus: Fix internal data structure initialization
@ 2016-02-24  8:40 Eli Billauer
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Billauer @ 2016-02-24  8:40 UTC (permalink / raw)
  To: arnd, gregkh; +Cc: linux-kernel, Eli Billauer

A couple of fields in a data structure, which is used by the driver only,
were not initialized properly during the driver's setup.

The primary issue with this bug was that channel->wr_buf_size remained zero,
so calls to dma_sync_single_for_cpu() took place with zero size, and
consequently did nothing.

This had a rather minimal practical impact, because

(a) these calls are NOPs on Intel/AMD platforms, as well as other platforms
    with coherent cache, and
(b) it's extremely rare that any cache line would survive between two reads
    from a given DMA buffer

Hence no significant practical difference is expected with this patch.

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
---
 drivers/char/xillybus/xillybus_core.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c
index 77d6c12..dcd19f3 100644
--- a/drivers/char/xillybus/xillybus_core.c
+++ b/drivers/char/xillybus/xillybus_core.c
@@ -509,7 +509,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
 			channel->log2_element_size = ((format > 2) ?
 						      2 : format);
 
-			bytebufsize = channel->rd_buf_size = bufsize *
+			bytebufsize = bufsize *
 				(1 << channel->log2_element_size);
 
 			buffers = devm_kcalloc(dev, bufnum,
@@ -523,6 +523,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
 
 		if (!is_writebuf) {
 			channel->num_rd_buffers = bufnum;
+			channel->rd_buf_size = bytebufsize;
 			channel->rd_allow_partial = allowpartial;
 			channel->rd_synchronous = synchronous;
 			channel->rd_exclusive_open = exclusive_open;
@@ -533,6 +534,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep,
 						   bufnum, bytebufsize);
 		} else if (channelnum > 0) {
 			channel->num_wr_buffers = bufnum;
+			channel->wr_buf_size = bytebufsize;
 
 			channel->seekable = seekable;
 			channel->wr_supports_nonempty = supports_nonempty;
-- 
1.7.2.3

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

end of thread, other threads:[~2016-02-24  8:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-23 11:41 [PATCH] char: xillybus: Fix internal data structure initialization Eli Billauer
2016-02-23 15:22 ` Greg KH
2016-02-23 15:35   ` Eli Billauer
  -- strict thread matches above, loose matches on Subject: below --
2016-02-24  8:40 Eli Billauer

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