diff mbox series

[ipsec-next] xfrm: use correct size to initialise sp->ovec

Message ID 1538878962-22453-1-git-send-email-lirongqing@baidu.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show
Series [ipsec-next] xfrm: use correct size to initialise sp->ovec | expand

Commit Message

Li RongQing Oct. 7, 2018, 3:22 a.m. UTC
This place should want to initialize array, not a element,
so it should be sizeof(array) instead of sizeof(element)

but now this array only has one element, so no error in
this condition that XFRM_MAX_OFFLOAD_DEPTH is 1

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/xfrm/xfrm_input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steffen Klassert Oct. 9, 2018, 8:20 a.m. UTC | #1
On Sun, Oct 07, 2018 at 10:22:42AM +0800, Li RongQing wrote:
> This place should want to initialize array, not a element,
> so it should be sizeof(array) instead of sizeof(element)
> 
> but now this array only has one element, so no error in
> this condition that XFRM_MAX_OFFLOAD_DEPTH is 1
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Also applied, thanks a lot Li!
diff mbox series

Patch

diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index be3520e429c9..684c0bc01e2c 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -131,7 +131,7 @@  struct sec_path *secpath_dup(struct sec_path *src)
 	sp->len = 0;
 	sp->olen = 0;
 
-	memset(sp->ovec, 0, sizeof(sp->ovec[XFRM_MAX_OFFLOAD_DEPTH]));
+	memset(sp->ovec, 0, sizeof(sp->ovec));
 
 	if (src) {
 		int i;