Skip to content

Commit 8ae90b7

Browse files
committed
Merge branch 'amend-hv_netvsc-copy-packets-sent-by-hyper-v-out-of-the-receive-buffer'
Andrea Parri says: ==================== Amend "hv_netvsc: Copy packets sent by Hyper-V out of the receive buffer" Patch #2 also addresses the Smatch complaint reported here: https://lkml.kernel.org/r/YBp2oVIdMe+G%2FliJ@mwanda/ ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 6b4950d + 8dff980 commit 8ae90b7

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

drivers/net/hyperv/netvsc.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int netvsc_init_buf(struct hv_device *device,
311311
struct nvsp_message *init_packet;
312312
unsigned int buf_size;
313313
size_t map_words;
314-
int ret = 0;
314+
int i, ret = 0;
315315

316316
/* Get receive buffer area. */
317317
buf_size = device_info->recv_sections * device_info->recv_section_size;
@@ -405,6 +405,16 @@ static int netvsc_init_buf(struct hv_device *device,
405405
goto cleanup;
406406
}
407407

408+
for (i = 0; i < VRSS_CHANNEL_MAX; i++) {
409+
struct netvsc_channel *nvchan = &net_device->chan_table[i];
410+
411+
nvchan->recv_buf = kzalloc(net_device->recv_section_size, GFP_KERNEL);
412+
if (nvchan->recv_buf == NULL) {
413+
ret = -ENOMEM;
414+
goto cleanup;
415+
}
416+
}
417+
408418
/* Setup receive completion ring.
409419
* Add 1 to the recv_section_cnt because at least one entry in a
410420
* ring buffer has to be empty.
@@ -1549,12 +1559,6 @@ struct netvsc_device *netvsc_device_add(struct hv_device *device,
15491559
for (i = 0; i < VRSS_CHANNEL_MAX; i++) {
15501560
struct netvsc_channel *nvchan = &net_device->chan_table[i];
15511561

1552-
nvchan->recv_buf = kzalloc(device_info->recv_section_size, GFP_KERNEL);
1553-
if (nvchan->recv_buf == NULL) {
1554-
ret = -ENOMEM;
1555-
goto cleanup2;
1556-
}
1557-
15581562
nvchan->channel = device->channel;
15591563
nvchan->net_device = net_device;
15601564
u64_stats_init(&nvchan->tx_stats.syncp);

drivers/net/hyperv/rndis_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ void rsc_add_data(struct netvsc_channel *nvchan,
465465
}
466466
nvchan->rsc.pktlen = len;
467467
if (hash_info != NULL) {
468-
nvchan->rsc.csum_info = *csum_info;
468+
nvchan->rsc.hash_info = *hash_info;
469469
nvchan->rsc.ppi_flags |= NVSC_RSC_HASH_INFO;
470470
} else {
471471
nvchan->rsc.ppi_flags &= ~NVSC_RSC_HASH_INFO;

0 commit comments

Comments
 (0)