public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ioatdma: Fix compiler warning
@ 2013-08-06 21:36 Jon Mason
  2013-08-06 21:52 ` Paul Bolle
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Mason @ 2013-08-06 21:36 UTC (permalink / raw)
  To: Dan Williams; +Cc: Dave Jiang, Vinod Koul, linux-kernel

GCC v4.6.3 complains:
drivers/dma/ioat/dma_v3.c: In function ‘__ioat3_prep_pq16_lock’:
drivers/dma/ioat/dma_v3.c:264:11: warning: array subscript is below array bounds [-Warray-bounds]
drivers/dma/ioat/dma_v3.c:264:11: warning: array subscript is below array bounds [-Warray-bounds]

This is due to the possibility of idx being negative, thus being outside
the boulds of the array.  Correct this by making idx an unsigned int.

Signed-off-by: Jon Mason <jon.mason@intel.com>
---
 drivers/dma/ioat/dma_v3.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
index ca6ea9b..a17ef21 100644
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -251,7 +251,7 @@ static bool is_bwd_noraid(struct pci_dev *pdev)
 }
 
 static void pq16_set_src(struct ioat_raw_descriptor *desc[3],
-			dma_addr_t addr, u32 offset, u8 coef, int idx)
+			 dma_addr_t addr, u32 offset, u8 coef, unsigned int idx)
 {
 	struct ioat_pq_descriptor *pq = (struct ioat_pq_descriptor *)desc[0];
 	struct ioat_pq16a_descriptor *pq16 =
@@ -1180,7 +1180,7 @@ __ioat3_prep_pq16_lock(struct dma_chan *c, enum sum_check_flags *result,
 	struct ioat_pq_descriptor *pq;
 	u32 offset = 0;
 	u8 op;
-	int i, s, idx, num_descs;
+	unsigned int i, s, idx, num_descs;
 
 	/* this function only handles src_cnt 9 - 16 */
 	BUG_ON(src_cnt < 9);
-- 
1.7.9.5


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

* Re: [PATCH] ioatdma: Fix compiler warning
  2013-08-06 21:36 [PATCH] ioatdma: Fix compiler warning Jon Mason
@ 2013-08-06 21:52 ` Paul Bolle
  2013-08-06 21:57   ` Jon Mason
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Bolle @ 2013-08-06 21:52 UTC (permalink / raw)
  To: Jon Mason; +Cc: Dan Williams, Dave Jiang, Vinod Koul, linux-kernel

On Tue, 2013-08-06 at 14:36 -0700, Jon Mason wrote:
> GCC v4.6.3 complains:
> drivers/dma/ioat/dma_v3.c: In function ‘__ioat3_prep_pq16_lock’:
> drivers/dma/ioat/dma_v3.c:264:11: warning: array subscript is below array bounds [-Warray-bounds]
> drivers/dma/ioat/dma_v3.c:264:11: warning: array subscript is below array bounds [-Warray-bounds]
> 
> This is due to the possibility of idx being negative, thus being outside
> the boulds of the array.  Correct this by making idx an unsigned int.
> 
> Signed-off-by: Jon Mason <jon.mason@intel.com>

I tried to silence these warnings in
https://lkml.org/lkml/2013/6/17/233 . And again, after some feedback, in
https://lkml.org/lkml/2013/7/20/137 . Perhaps that second patch is
queued somewhere. I don't know.


Paul Bolle


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

* Re: [PATCH] ioatdma: Fix compiler warning
  2013-08-06 21:52 ` Paul Bolle
@ 2013-08-06 21:57   ` Jon Mason
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Mason @ 2013-08-06 21:57 UTC (permalink / raw)
  To: Paul Bolle; +Cc: Dan Williams, Dave Jiang, Vinod Koul, linux-kernel

On Tue, Aug 06, 2013 at 11:52:35PM +0200, Paul Bolle wrote:
> On Tue, 2013-08-06 at 14:36 -0700, Jon Mason wrote:
> > GCC v4.6.3 complains:
> > drivers/dma/ioat/dma_v3.c: In function ‘__ioat3_prep_pq16_lock’:
> > drivers/dma/ioat/dma_v3.c:264:11: warning: array subscript is below array bounds [-Warray-bounds]
> > drivers/dma/ioat/dma_v3.c:264:11: warning: array subscript is below array bounds [-Warray-bounds]
> > 
> > This is due to the possibility of idx being negative, thus being outside
> > the boulds of the array.  Correct this by making idx an unsigned int.
> > 
> > Signed-off-by: Jon Mason <jon.mason@intel.com>
> 
> I tried to silence these warnings in
> https://lkml.org/lkml/2013/6/17/233 . And again, after some feedback, in
> https://lkml.org/lkml/2013/7/20/137 . Perhaps that second patch is
> queued somewhere. I don't know.

I stupidly didn't check for an existing patch before I sent it out.
Hopefully Dan/Vinod has your last one queued.

Thanks,
Jon

> 
> 
> Paul Bolle
> 

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

end of thread, other threads:[~2013-08-06 21:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-06 21:36 [PATCH] ioatdma: Fix compiler warning Jon Mason
2013-08-06 21:52 ` Paul Bolle
2013-08-06 21:57   ` Jon Mason

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