IB/srpt: Support HCAs with more than two ports
Since there are adapters that have four ports, increase the size of the srpt_device.port[] array. This patch avoids that the following warning is hit with quad port Chelsio adapters: WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port)); Reported-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Steve Wise <swise@opengridcomputing.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: <stable@vger.kernel.org> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
68348441ef
commit
e620ebfc22
@@ -2970,7 +2970,8 @@ static void srpt_add_one(struct ib_device *device)
|
||||
|
||||
pr_debug("device = %p\n", device);
|
||||
|
||||
sdev = kzalloc(sizeof(*sdev), GFP_KERNEL);
|
||||
sdev = kzalloc(struct_size(sdev, port, device->phys_port_cnt),
|
||||
GFP_KERNEL);
|
||||
if (!sdev)
|
||||
goto err;
|
||||
|
||||
@@ -3024,8 +3025,6 @@ static void srpt_add_one(struct ib_device *device)
|
||||
srpt_event_handler);
|
||||
ib_register_event_handler(&sdev->event_handler);
|
||||
|
||||
WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));
|
||||
|
||||
for (i = 1; i <= sdev->device->phys_port_cnt; i++) {
|
||||
sport = &sdev->port[i - 1];
|
||||
INIT_LIST_HEAD(&sport->nexus_list);
|
||||
|
Reference in New Issue
Block a user