Sfoglia il codice sorgente

[hermon] Assert that mapping length is non-zero

An (impossible) mapping length of zero produces a negative bit shift,
which is technically undefined.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 anni fa
parent
commit
dea5b74475
1 ha cambiato i file con 1 aggiunte e 0 eliminazioni
  1. 1
    0
      src/drivers/infiniband/hermon.c

+ 1
- 0
src/drivers/infiniband/hermon.c Vedi File

@@ -2113,6 +2113,7 @@ static int hermon_map_vpm ( struct hermon *hermon,
2113 2113
 	assert ( ( va & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2114 2114
 	assert ( ( pa & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2115 2115
 	assert ( ( len & ( HERMON_PAGE_SIZE - 1 ) ) == 0 );
2116
+	assert ( len != 0 );
2116 2117
 
2117 2118
 	/* Calculate starting points */
2118 2119
 	start = pa;

Loading…
Annulla
Salva