[Bug 218002] sys/dev/mps/mps.c: PVS-Studio: Dead Code (CWE-561)

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 02 Feb 2025 16:26:01 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=218002

Warner Losh <imp@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |imp@FreeBSD.org
         Resolution|---                         |Not A Bug
             Status|New                         |Closed

--- Comment #1 from Warner Losh <imp@FreeBSD.org> ---
So this bug doesn't matter.

sc->num_reqs is used only to allocate commands and free them on detach. On a
panic, neither of these paths is used. So it doesn't matter if this happens
before or after the panic. It won't affect the panic.

Sometime people make panics advisory (not something in the base). In these
cases it's not dead code. And honestly it doesn't matter where it's set.

Also, there was a though, ages ago, that this shouldn't be a panic. First, it's
a relatively rate situation. Allocating the DMAMAP at this point in the code
should always be possible, except if you load the mps driver during a severe
memory shortage / fragmentation condition. Second, the driver should be able to
cope with the fewer commands, though not as efficiently. It's a no win
situation, and as the comments state, it's not at all clear this is a fatal
condition. Some users have run with this line commented out.

So while there's nothing wrong with this patch, I'm going to reject it and the
sister report for mpr.  It's one more change to the driver I have to test,
compile and spend time on that gives no benefit.

-- 
You are receiving this mail because:
You are the assignee for the bug.