Thread (78 messages) 78 messages, 4 authors, 2015-09-23

Re: [PATCH v2 12/30] cxlflash: Refine host/device attributes

From: Matthew R. Ochs <hidden>
Date: 2015-09-18 23:56:30
Also in: linux-scsi

On Sep 18, 2015, at 4:34 PM, Brian King [off-list ref] =
wrote:
On 09/16/2015 04:29 PM, Matthew R. Ochs wrote:
quoted
=20
+	ssize_t bytes =3D 0;
+	__be64 __iomem *fc_port;
+
+	if (port >=3D NUM_FC_PORTS)
+		return 0;
+
+	fc_port =3D &afu->afu_map->global.fc_port[port][0];
+
+	for (i =3D 0; i < CXLFLASH_NUM_VLUNS; i++, buf +=3D 22)
=20
Rather than this bug prone hard coded 22, how about never incrementing =
buf and do something
similar to this:
=20
quoted
+		bytes +=3D scnprintf(buf, PAGE_SIZE, "%03d: %016llX\n",
+				   i, readq_be(&fc_port[i]));
=20
		bytes +=3D scnprintf(&buf[bytes], PAGE_SIZE, "%03d: =
%016llX\n",
				   i, readq_be(&fc_port[i]));
=20
quoted
+	return bytes;
+}
+
Great suggestion! Will fix in v3.


-matt=
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help