Commit 2c4aac74 authored by Rick Farrington's avatar Rick Farrington Committed by David S. Miller

liquidio: lowmem: init allocated memory to 0

For defensive programming, zero the allocated block 'oct->droq[0]' in
octeon_setup_output_queues() and 'oct->instr_queue[0]' in
octeon_setup_instr_queues().
Signed-off-by: default avatarRick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: default avatarSatanand Burla <satananda.burla@cavium.com>
Signed-off-by: default avatarRaghu Vatsavayi <raghu.vatsavayi@cavium.com>
Signed-off-by: default avatarFelix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 689062a1
...@@ -876,11 +876,11 @@ int octeon_setup_instr_queues(struct octeon_device *oct) ...@@ -876,11 +876,11 @@ int octeon_setup_instr_queues(struct octeon_device *oct)
oct->num_iqs = 0; oct->num_iqs = 0;
oct->instr_queue[0] = vmalloc_node(sizeof(*oct->instr_queue[0]), oct->instr_queue[0] = vzalloc_node(sizeof(*oct->instr_queue[0]),
numa_node); numa_node);
if (!oct->instr_queue[0]) if (!oct->instr_queue[0])
oct->instr_queue[0] = oct->instr_queue[0] =
vmalloc(sizeof(struct octeon_instr_queue)); vzalloc(sizeof(struct octeon_instr_queue));
if (!oct->instr_queue[0]) if (!oct->instr_queue[0])
return 1; return 1;
memset(oct->instr_queue[0], 0, sizeof(struct octeon_instr_queue)); memset(oct->instr_queue[0], 0, sizeof(struct octeon_instr_queue));
...@@ -923,9 +923,9 @@ int octeon_setup_output_queues(struct octeon_device *oct) ...@@ -923,9 +923,9 @@ int octeon_setup_output_queues(struct octeon_device *oct)
desc_size = CFG_GET_DEF_RX_BUF_SIZE(CHIP_CONF(oct, cn23xx_vf)); desc_size = CFG_GET_DEF_RX_BUF_SIZE(CHIP_CONF(oct, cn23xx_vf));
} }
oct->num_oqs = 0; oct->num_oqs = 0;
oct->droq[0] = vmalloc_node(sizeof(*oct->droq[0]), numa_node); oct->droq[0] = vzalloc_node(sizeof(*oct->droq[0]), numa_node);
if (!oct->droq[0]) if (!oct->droq[0])
oct->droq[0] = vmalloc(sizeof(*oct->droq[0])); oct->droq[0] = vzalloc(sizeof(*oct->droq[0]));
if (!oct->droq[0]) if (!oct->droq[0])
return 1; return 1;
......
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