diff options
Diffstat (limited to 'net/packet/af_packet.c')
-rw-r--r-- | net/packet/af_packet.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 0f661745df0f..8a10d5b3c832 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -592,7 +592,7 @@ static void init_prb_bdqc(struct packet_sock *po, | |||
592 | p1->knxt_seq_num = 1; | 592 | p1->knxt_seq_num = 1; |
593 | p1->pkbdq = pg_vec; | 593 | p1->pkbdq = pg_vec; |
594 | pbd = (struct tpacket_block_desc *)pg_vec[0].buffer; | 594 | pbd = (struct tpacket_block_desc *)pg_vec[0].buffer; |
595 | p1->pkblk_start = (char *)pg_vec[0].buffer; | 595 | p1->pkblk_start = pg_vec[0].buffer; |
596 | p1->kblk_size = req_u->req3.tp_block_size; | 596 | p1->kblk_size = req_u->req3.tp_block_size; |
597 | p1->knum_blocks = req_u->req3.tp_block_nr; | 597 | p1->knum_blocks = req_u->req3.tp_block_nr; |
598 | p1->hdrlen = po->tp_hdrlen; | 598 | p1->hdrlen = po->tp_hdrlen; |
@@ -824,8 +824,7 @@ static void prb_open_block(struct tpacket_kbdq_core *pkc1, | |||
824 | h1->ts_first_pkt.ts_sec = ts.tv_sec; | 824 | h1->ts_first_pkt.ts_sec = ts.tv_sec; |
825 | h1->ts_first_pkt.ts_nsec = ts.tv_nsec; | 825 | h1->ts_first_pkt.ts_nsec = ts.tv_nsec; |
826 | pkc1->pkblk_start = (char *)pbd1; | 826 | pkc1->pkblk_start = (char *)pbd1; |
827 | pkc1->nxt_offset = (char *)(pkc1->pkblk_start + | 827 | pkc1->nxt_offset = pkc1->pkblk_start + BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
828 | BLK_PLUS_PRIV(pkc1->blk_sizeof_priv)); | ||
829 | BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); | 828 | BLOCK_O2FP(pbd1) = (__u32)BLK_PLUS_PRIV(pkc1->blk_sizeof_priv); |
830 | BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN; | 829 | BLOCK_O2PRIV(pbd1) = BLK_HDR_LEN; |
831 | pbd1->version = pkc1->version; | 830 | pbd1->version = pkc1->version; |
@@ -1018,7 +1017,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po, | |||
1018 | struct tpacket_block_desc *pbd; | 1017 | struct tpacket_block_desc *pbd; |
1019 | char *curr, *end; | 1018 | char *curr, *end; |
1020 | 1019 | ||
1021 | pkc = GET_PBDQC_FROM_RB(((struct packet_ring_buffer *)&po->rx_ring)); | 1020 | pkc = GET_PBDQC_FROM_RB(&po->rx_ring); |
1022 | pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc); | 1021 | pbd = GET_CURR_PBLOCK_DESC_FROM_CORE(pkc); |
1023 | 1022 | ||
1024 | /* Queue is frozen when user space is lagging behind */ | 1023 | /* Queue is frozen when user space is lagging behind */ |
@@ -1044,7 +1043,7 @@ static void *__packet_lookup_frame_in_block(struct packet_sock *po, | |||
1044 | smp_mb(); | 1043 | smp_mb(); |
1045 | curr = pkc->nxt_offset; | 1044 | curr = pkc->nxt_offset; |
1046 | pkc->skb = skb; | 1045 | pkc->skb = skb; |
1047 | end = (char *) ((char *)pbd + pkc->kblk_size); | 1046 | end = (char *)pbd + pkc->kblk_size; |
1048 | 1047 | ||
1049 | /* first try the current block */ | 1048 | /* first try the current block */ |
1050 | if (curr+TOTAL_PKT_LEN_INCL_ALIGN(len) < end) { | 1049 | if (curr+TOTAL_PKT_LEN_INCL_ALIGN(len) < end) { |
@@ -1476,7 +1475,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, | |||
1476 | * Find the device first to size check it | 1475 | * Find the device first to size check it |
1477 | */ | 1476 | */ |
1478 | 1477 | ||
1479 | saddr->spkt_device[13] = 0; | 1478 | saddr->spkt_device[sizeof(saddr->spkt_device) - 1] = 0; |
1480 | retry: | 1479 | retry: |
1481 | rcu_read_lock(); | 1480 | rcu_read_lock(); |
1482 | dev = dev_get_by_name_rcu(sock_net(sk), saddr->spkt_device); | 1481 | dev = dev_get_by_name_rcu(sock_net(sk), saddr->spkt_device); |