Project

General

Profile

Bug #3020

sys/dev/disk/nvme/nvme_admin.c: non terminating loop and poor error checking ?

Added by dcb 7 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Driver
Target version:
-
Start date:
04/11/2017
Due date:
% Done:

0%


Description

1.

dragonfly/sys/dev/disk/nvme/nvme_admin.c:578]: (style) Unsigned variable 'j' cannot be negative so it is unnecessary to test it.

for (j = NVME_MAX_NAMESPACES - 1; j >= 0; --j) {

but

uint32_t j;

2. dragonfly/sys/dev/disk/nvme/nvme_admin.c:584]: (style) Checking if unsigned variable 'j' is less than zero.

Source code is

if (j < 0) {
device_printf(sc->dev, "not enough room in nscary for "
"namespace %08x\n", rp->nsids[i]);
nvme_put_request(req);
continue;
}

I can't think of any scenario where this code would be executed.

0001-Avoid-checking-negativeness-of-unsigned-variable.patch View - nvme_admin.c fixed patch (1.41 KB) lubos, 10/05/2017 01:31 PM

History

#1 Updated by lubos about 1 month ago

  • File 0001-Avoid-checking-negativeness-of-unsigned-variable.patch added
  • Category set to Driver

Proposing patch.

--

Lubos Boucek

#3 Updated by lubos about 1 month ago

  • File deleted (0001-Avoid-checking-negativeness-of-unsigned-variable.patch)

#4 Updated by lubos about 1 month ago

Fixed by Matthew Dillon (b9045046a56b099b2d7d82f1d1bb3dfd7aa1699d).

This report can be closed now.

#5 Updated by swildner about 1 month ago

  • Status changed from New to Closed

Also available in: Atom PDF