public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] infiniband/hw/nes/nes_verbs.c: fix off-by-one
@ 2008-02-19 22:59 Adrian Bunk
  2008-02-20  4:23 ` [ofa-general] " Roland Dreier
  0 siblings, 1 reply; 65+ messages in thread
From: Adrian Bunk @ 2008-02-19 22:59 UTC (permalink / raw)
  To: flatif, gstreiff; +Cc: general, linux-kernel

This patch fixes an off-by-one spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

 drivers/infiniband/hw/nes/nes_verbs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6/drivers/infiniband/hw/nes/nes_verbs.c.old	2008-02-20 00:20:47.000000000 +0200
+++ linux-2.6/drivers/infiniband/hw/nes/nes_verbs.c	2008-02-20 00:21:09.000000000 +0200
@@ -916,33 +916,33 @@ static struct ib_pd *nes_alloc_pd(struct
 	if (!nespd) {
 		nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
 		return ERR_PTR(-ENOMEM);
 	}
 
 	nes_debug(NES_DBG_PD, "Allocating PD (%p) for ib device %s\n",
 			nespd, nesvnic->nesibdev->ibdev.name);
 
 	nespd->pd_id = (pd_num << (PAGE_SHIFT-12)) + nesadapter->base_pd;
 
 	if (context) {
 		nesucontext = to_nesucontext(context);
 		nespd->mmap_db_index = find_next_zero_bit(nesucontext->allocated_doorbells,
 				NES_MAX_USER_DB_REGIONS, nesucontext->first_free_db);
 		nes_debug(NES_DBG_PD, "find_first_zero_biton doorbells returned %u, mapping pd_id %u.\n",
 				nespd->mmap_db_index, nespd->pd_id);
-		if (nespd->mmap_db_index > NES_MAX_USER_DB_REGIONS) {
+		if (nespd->mmap_db_index >= NES_MAX_USER_DB_REGIONS) {
 			nes_debug(NES_DBG_PD, "mmap_db_index > MAX\n");
 			nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
 			kfree(nespd);
 			return ERR_PTR(-ENOMEM);
 		}
 
 		uresp.pd_id = nespd->pd_id;
 		uresp.mmap_db_index = nespd->mmap_db_index;
 		if (ib_copy_to_udata(udata, &uresp, sizeof (struct nes_alloc_pd_resp))) {
 			nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
 			kfree(nespd);
 			return ERR_PTR(-EFAULT);
 		}
 
 		set_bit(nespd->mmap_db_index, nesucontext->allocated_doorbells);
 		nesucontext->mmap_db_index[nespd->mmap_db_index] = nespd->pd_id;


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

end of thread, other threads:[~2008-02-24 14:47 UTC | newest]

Thread overview: 65+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-19 22:59 [2.6 patch] infiniband/hw/nes/nes_verbs.c: fix off-by-one Adrian Bunk
2008-02-20  4:23 ` [ofa-general] " Roland Dreier
2008-02-20  5:57   ` Adrian Bunk
2008-02-20 23:21     ` Roland Dreier
2008-02-20 23:27       ` Glenn Streiff
2008-02-21 12:39         ` Glenn Streiff
2008-02-21 15:49           ` Adrian Bunk
2008-02-21 20:28             ` Roland Dreier
2008-02-21 21:01               ` Merging of completely unreviewed drivers Adrian Bunk
2008-02-21 21:09                 ` Roland Dreier
2008-02-21 21:14                 ` Linus Torvalds
2008-02-21 22:33                   ` Alexey Dobriyan
2008-02-21 22:43                     ` Greg KH
2008-02-21 22:57                       ` Jeff Garzik
2008-02-21 22:58                       ` Alexey Dobriyan
2008-02-21 23:31                       ` Jan Engelhardt
2008-02-21 23:38                   ` Krzysztof Halasa
2008-02-21 23:31                     ` Alan Cox
2008-02-22  0:29                       ` Adrian Bunk
2008-02-21 23:41                     ` Jeff Garzik
2008-02-22  0:05                       ` Krzysztof Halasa
2008-02-22  0:44                         ` Jeff Garzik
2008-02-22  2:02                           ` Krzysztof Halasa
2008-02-22 10:04                         ` Alan Cox
2008-02-22 18:45                         ` Pavel Machek
2008-02-22 22:44                           ` Krzysztof Halasa
2008-02-23  9:43                             ` Pavel Machek
2008-02-23 12:38                               ` David Newall
2008-02-23 15:25                                 ` Pavel Machek
2008-02-24  3:18                                   ` David Newall
2008-02-23 17:33                                 ` Linus Torvalds
2008-02-24  3:26                                   ` David Newall
2008-02-24  4:47                                     ` Linus Torvalds
2008-02-23 13:58                               ` Krzysztof Halasa
2008-02-22  1:46                     ` David Newall
2008-02-22  2:06                       ` Al Viro
2008-02-22  2:23                         ` Krzysztof Halasa
2008-02-22  3:13                           ` Al Viro
2008-02-22 22:28                             ` Krzysztof Halasa
2008-02-24  7:47                               ` Jörn Engel
2008-02-24 14:47                                 ` Krzysztof Halasa
2008-02-22  3:13                         ` Linus Torvalds
2008-02-22  6:29                           ` [ofa-general] " Junio C Hamano
2008-02-22  9:02                             ` Adrian Bunk
2008-02-22  6:37                           ` Ray Lee
2008-02-23 15:31                             ` Jan Engelhardt
2008-02-24  3:22                               ` David Newall
2008-02-22 22:37                           ` Krzysztof Halasa
2008-02-22 12:29                       ` [ofa-general] " Bart Van Assche
2008-02-22 14:25                         ` David Newall
2008-02-22 15:17                           ` Peter Zijlstra
2008-02-22 16:48                             ` John W. Linville
2008-02-22 22:59                             ` Krzysztof Halasa
2008-02-22 23:14                               ` Al Viro
2008-02-22 15:48                           ` John W. Linville
2008-02-22 18:54                   ` Ingo Molnar
2008-02-22 19:11                     ` [ofa-general] " Bart Van Assche
2008-02-22 19:20                     ` Jeff Garzik
2008-02-22 19:44                       ` Greg KH
2008-02-21 21:30                 ` Greg KH
2008-02-22  1:06                   ` Adrian Bunk
2008-02-21 22:08                 ` Arjan van de Ven
2008-02-21 22:33                   ` Jeff Garzik
2008-02-21 23:40                     ` Adrian Bunk
2008-02-22 18:40                   ` Pavel Machek

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