diff mbox

[libibverbs] init.c: increase sysfs read buffer size to 16

Message ID 1449184181-25676-1-git-send-email-jsquyres@cisco.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jeff Squyres Dec. 3, 2015, 11:09 p.m. UTC
The default value of 8 is too small to read
/sys/class/infiniband/usnic_x/node_type, which contains "6: usNIC
UDP".  Per a7a73a8c1b39362f1701256bc772d82847832f9c, the too-small
buffer causes a stderr warning to be emitted from ibv_devinfo when
reading usNIC devices.

This commit therefore increases the buffer size to 16, which is long
enough to read the usNIC node_type value.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Signed-off-by: Xuyang Wang <xuywang@cisco.com>
---
 src/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Haggai Eran Dec. 7, 2015, 1:27 p.m. UTC | #1
On 12/04/2015 01:09 AM, Jeff Squyres wrote:
> The default value of 8 is too small to read
> /sys/class/infiniband/usnic_x/node_type, which contains "6: usNIC
> UDP".  Per a7a73a8c1b39362f1701256bc772d82847832f9c, the too-small
> buffer causes a stderr warning to be emitted from ibv_devinfo when
> reading usNIC devices.
> 
> This commit therefore increases the buffer size to 16, which is long
> enough to read the usNIC node_type value.

Reviewed-by: Haggai Eran <haggaie@mellanox.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Squyres Dec. 9, 2015, 3:05 p.m. UTC | #2
Any further comments on this?

Doug -- does it look ok to you?


> On Dec 7, 2015, at 5:27 AM, Haggai Eran <haggaie@mellanox.com> wrote:
> 
> On 12/04/2015 01:09 AM, Jeff Squyres wrote:
>> The default value of 8 is too small to read
>> /sys/class/infiniband/usnic_x/node_type, which contains "6: usNIC
>> UDP".  Per a7a73a8c1b39362f1701256bc772d82847832f9c, the too-small
>> buffer causes a stderr warning to be emitted from ibv_devinfo when
>> reading usNIC devices.
>> 
>> This commit therefore increases the buffer size to 16, which is long
>> enough to read the usNIC node_type value.
> 
> Reviewed-by: Haggai Eran <haggaie@mellanox.com>
Doug Ledford Dec. 9, 2015, 9:36 p.m. UTC | #3
On 12/09/2015 10:05 AM, Jeff Squyres (jsquyres) wrote:
> Any further comments on this?
> 
> Doug -- does it look ok to you?
> 
> 
>> On Dec 7, 2015, at 5:27 AM, Haggai Eran <haggaie@mellanox.com> wrote:
>>
>> On 12/04/2015 01:09 AM, Jeff Squyres wrote:
>>> The default value of 8 is too small to read
>>> /sys/class/infiniband/usnic_x/node_type, which contains "6: usNIC
>>> UDP".  Per a7a73a8c1b39362f1701256bc772d82847832f9c, the too-small
>>> buffer causes a stderr warning to be emitted from ibv_devinfo when
>>> reading usNIC devices.
>>>
>>> This commit therefore increases the buffer size to 16, which is long
>>> enough to read the usNIC node_type value.
>>
>> Reviewed-by: Haggai Eran <haggaie@mellanox.com>
> 
> 

Yeah, looks fine to me.  I'll pull it in shortly.
diff mbox

Patch

diff --git a/src/init.c b/src/init.c
index dbdd795..ef78871 100644
--- a/src/init.c
+++ b/src/init.c
@@ -351,7 +351,7 @@  static struct ibv_device *try_driver(struct ibv_driver *driver,
 {
 	struct verbs_device *vdev;
 	struct ibv_device *dev;
-	char value[8];
+	char value[16];
 
 	if (driver->init_func) {
 		dev = driver->init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);