[PATCH] nvmet: fix the CSTS state iteration in debugfs

Keith Busch kbusch at kernel.org
Fri Nov 20 11:54:24 PST 2026


On Sun, 15 Nov 2026 01:28:06 +0800 (CST), shao.mingyin at zte.com.cn wrote:
> nvmet_ctrl_state_show() uses the size of a sparse name array as a
> bit count.  Its last index is NVME_CSTS_PP (BIT(5)), so the loop has
> 33 iterations and evaluates BIT(32).  This exceeds the width of an
> unsigned long on 32-bit systems.  With GCC on x86 this can make a
> normal ready status print "ready|ready".
> 
> Iterate over the 32 bits of csts instead.  Check the name array bounds
> before indexing it and print unknown bits as unsigned values.  The
> out-of-bounds lookup requires a reserved status bit; the current target
> code does not set those bits.
> 
> [...]

Thanks, applied to nvme-7.4.

[1/1] nvmet: fix the CSTS state iteration in debugfs
      commit: fedfd360c2f6e00d7c566ee5ed52e2ee46c99b8d
--
Keith Busch <kbusch at kernel.org>




More information about the Linux-nvme mailing list