xfrm_compat.c (eb6c59b735aa6cca77cdbb59cc69d69a0d63d986) | xfrm_compat.c (b6ee896385380aa621102e8ea402ba12db1cabff) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * XFRM compat layer 4 * Author: Dmitry Safonov <dima@arista.com> 5 * Based on code and translator idea by: Florian Westphal <fw@strlen.de> 6 */ 7#include <linux/compat.h> | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * XFRM compat layer 4 * Author: Dmitry Safonov <dima@arista.com> 5 * Based on code and translator idea by: Florian Westphal <fw@strlen.de> 6 */ 7#include <linux/compat.h> |
8#include <linux/nospec.h> |
|
8#include <linux/xfrm.h> 9#include <net/xfrm.h> 10 11struct compat_xfrm_lifetime_cfg { 12 compat_u64 soft_byte_limit, hard_byte_limit; 13 compat_u64 soft_packet_limit, hard_packet_limit; 14 compat_u64 soft_add_expires_seconds, hard_add_expires_seconds; 15 compat_u64 soft_use_expires_seconds, hard_use_expires_seconds; --- 416 unchanged lines hidden (view full) --- 432 u16 pol_len32, pol_len64; 433 int err; 434 435 if (type > XFRMA_MAX) { 436 BUILD_BUG_ON(XFRMA_MAX != XFRMA_MTIMER_THRESH); 437 NL_SET_ERR_MSG(extack, "Bad attribute"); 438 return -EOPNOTSUPP; 439 } | 9#include <linux/xfrm.h> 10#include <net/xfrm.h> 11 12struct compat_xfrm_lifetime_cfg { 13 compat_u64 soft_byte_limit, hard_byte_limit; 14 compat_u64 soft_packet_limit, hard_packet_limit; 15 compat_u64 soft_add_expires_seconds, hard_add_expires_seconds; 16 compat_u64 soft_use_expires_seconds, hard_use_expires_seconds; --- 416 unchanged lines hidden (view full) --- 433 u16 pol_len32, pol_len64; 434 int err; 435 436 if (type > XFRMA_MAX) { 437 BUILD_BUG_ON(XFRMA_MAX != XFRMA_MTIMER_THRESH); 438 NL_SET_ERR_MSG(extack, "Bad attribute"); 439 return -EOPNOTSUPP; 440 } |
441 type = array_index_nospec(type, XFRMA_MAX + 1); |
|
440 if (nla_len(nla) < compat_policy[type].len) { 441 NL_SET_ERR_MSG(extack, "Attribute bad length"); 442 return -EOPNOTSUPP; 443 } 444 445 pol_len32 = compat_policy[type].len; 446 pol_len64 = xfrma_policy[type].len; 447 --- 226 unchanged lines hidden --- | 442 if (nla_len(nla) < compat_policy[type].len) { 443 NL_SET_ERR_MSG(extack, "Attribute bad length"); 444 return -EOPNOTSUPP; 445 } 446 447 pol_len32 = compat_policy[type].len; 448 pol_len64 = xfrma_policy[type].len; 449 --- 226 unchanged lines hidden --- |