[DragonFlyBSD - Bug #3020] (New) sys/dev/disk/nvme/nvme_admin.c: non terminating loop and poor error checking ?

bugtracker-admin at leaf.dragonflybsd.org bugtracker-admin at leaf.dragonflybsd.org
Tue Apr 11 11:38:16 PDT 2017


Issue #3020 has been reported by dcb.

----------------------------------------
Bug #3020: sys/dev/disk/nvme/nvme_admin.c: non terminating loop and poor error checking ?
http://bugs.dragonflybsd.org/issues/3020

* Author: dcb
* Status: New
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------

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.




-- 
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account


More information about the Bugs mailing list