Commit 6a4b5058 authored by Koichiro Den's avatar Koichiro Den Committed by Jon Mason
Browse files

NTB: ntb_transport: Fix too small buffer for debugfs_name



The buffer used for "qp%d" was only 4 bytes, which truncates names like
"qp10" to "qp1" and causes multiple queues to share the same directory.

Enlarge the buffer and use sizeof() to avoid truncation.

Fixes: fce8a7bb ("PCI-Express Non-Transparent Bridge Support")
Cc: <stable@vger.kernel.org> # v3.9+
Reviewed-by: default avatarFrank Li <Frank.Li@nxp.com>
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Signed-off-by: default avatarKoichiro Den <den@valinux.co.jp>
Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
parent 21fbdc4d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1252,9 +1252,9 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt,
	qp->tx_max_entry = tx_size / qp->tx_max_frame;

	if (nt->debugfs_node_dir) {
		char debugfs_name[4];
		char debugfs_name[8];

		snprintf(debugfs_name, 4, "qp%d", qp_num);
		snprintf(debugfs_name, sizeof(debugfs_name), "qp%d", qp_num);
		qp->debugfs_dir = debugfs_create_dir(debugfs_name,
						     nt->debugfs_node_dir);