| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * IEEE 802.1Q Multiple Registration Protocol (MRP) |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Adapted from code in net/802/garp.c |
|---|
| 7 | 8 | * Copyright (c) 2008 Patrick McHardy <kaber@trash.net> |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or |
|---|
| 10 | | - * modify it under the terms of the GNU General Public License |
|---|
| 11 | | - * version 2 as published by the Free Software Foundation. |
|---|
| 12 | 9 | */ |
|---|
| 13 | 10 | #include <linux/kernel.h> |
|---|
| 14 | 11 | #include <linux/timer.h> |
|---|
| .. | .. |
|---|
| 539 | 536 | struct mrp_attr *attr; |
|---|
| 540 | 537 | |
|---|
| 541 | 538 | if (sizeof(struct mrp_skb_cb) + len > |
|---|
| 542 | | - FIELD_SIZEOF(struct sk_buff, cb)) |
|---|
| 539 | + sizeof_field(struct sk_buff, cb)) |
|---|
| 543 | 540 | return -ENOMEM; |
|---|
| 544 | 541 | |
|---|
| 545 | 542 | spin_lock_bh(&app->lock); |
|---|
| .. | .. |
|---|
| 564 | 561 | struct mrp_attr *attr; |
|---|
| 565 | 562 | |
|---|
| 566 | 563 | if (sizeof(struct mrp_skb_cb) + len > |
|---|
| 567 | | - FIELD_SIZEOF(struct sk_buff, cb)) |
|---|
| 564 | + sizeof_field(struct sk_buff, cb)) |
|---|
| 568 | 565 | return; |
|---|
| 569 | 566 | |
|---|
| 570 | 567 | spin_lock_bh(&app->lock); |
|---|
| .. | .. |
|---|
| 708 | 705 | * advance to the next event in its Vector. |
|---|
| 709 | 706 | */ |
|---|
| 710 | 707 | if (sizeof(struct mrp_skb_cb) + mrp_cb(skb)->mh->attrlen > |
|---|
| 711 | | - FIELD_SIZEOF(struct sk_buff, cb)) |
|---|
| 708 | + sizeof_field(struct sk_buff, cb)) |
|---|
| 712 | 709 | return -1; |
|---|
| 713 | 710 | if (skb_copy_bits(skb, *offset, mrp_cb(skb)->attrvalue, |
|---|
| 714 | 711 | mrp_cb(skb)->mh->attrlen) < 0) |
|---|