The > should be >= or otherwise we could end up reading one element beyond the end of the array. Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- block/partitions/ldm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c index 16766f267559..f48bcd2f5226 100644 --- a/block/partitions/ldm.c +++ b/block/partitions/ldm.c @@ -636,7 +636,7 @@ static int ldm_relative(const u8 *buffer, int buflen, int base, int offset) { base += offset; - if (!buffer || offset < 0 || base > buflen) { + if (!buffer || offset < 0 || base >= buflen) { if (!buffer) ldm_error("!buffer"); if (offset < 0) -- 2.18.0