Commit 59072ba1 authored by Shannon Nelson's avatar Shannon Nelson Committed by Jeff Kirsher

i40e: check vsi ptrs before dumping them

Make sure there really are rings and queues before trying to dump
information in them.
Signed-off-by: default avatarShannon Nelson <shannon.nelson@intel.com>
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: default avatarKavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 738a9e9b
...@@ -234,27 +234,34 @@ static ssize_t i40e_dbg_dump_write(struct file *filp, ...@@ -234,27 +234,34 @@ static ssize_t i40e_dbg_dump_write(struct file *filp,
memcpy(p, vsi, len); memcpy(p, vsi, len);
p += len; p += len;
if (vsi->num_q_vectors) {
len = (sizeof(struct i40e_q_vector) len = (sizeof(struct i40e_q_vector)
* vsi->num_q_vectors); * vsi->num_q_vectors);
memcpy(p, vsi->q_vectors, len); memcpy(p, vsi->q_vectors, len);
p += len; p += len;
}
len = (sizeof(struct i40e_ring) * vsi->num_queue_pairs); if (vsi->num_queue_pairs) {
len = (sizeof(struct i40e_ring) *
vsi->num_queue_pairs);
memcpy(p, vsi->tx_rings, len); memcpy(p, vsi->tx_rings, len);
p += len; p += len;
memcpy(p, vsi->rx_rings, len); memcpy(p, vsi->rx_rings, len);
p += len; p += len;
}
for (i = 0; i < vsi->num_queue_pairs; i++) { if (vsi->tx_rings[0]) {
len = sizeof(struct i40e_tx_buffer); len = sizeof(struct i40e_tx_buffer);
for (i = 0; i < vsi->num_queue_pairs; i++) {
memcpy(p, vsi->tx_rings[i]->tx_bi, len); memcpy(p, vsi->tx_rings[i]->tx_bi, len);
p += len; p += len;
} }
for (i = 0; i < vsi->num_queue_pairs; i++) {
len = sizeof(struct i40e_rx_buffer); len = sizeof(struct i40e_rx_buffer);
for (i = 0; i < vsi->num_queue_pairs; i++) {
memcpy(p, vsi->rx_rings[i]->rx_bi, len); memcpy(p, vsi->rx_rings[i]->rx_bi, len);
p += len; p += len;
} }
}
/* macvlan filter list */ /* macvlan filter list */
len = sizeof(struct i40e_mac_filter); len = sizeof(struct i40e_mac_filter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment