提交 5e5234ff 编写于 作者: H Herbert Xu

[IPSEC]: Fix uninitialised dst warning in __xfrm_lookup

Andrew Morton reported that __xfrm_lookup generates this warning:

net/xfrm/xfrm_policy.c: In function '__xfrm_lookup':
net/xfrm/xfrm_policy.c:1449: warning: 'dst' may be used uninitialized in this function

This is because if policy->action is of an unexpected value then dst will
not be initialised.  Of course, in practice this should never happen since
the input layer xfrm_user/af_key will filter out all illegal values.  But
the compiler doesn't know that of course.

So this patch fixes this by taking the conservative approach and treat all
unknown actions the same as a blocking action.

Thanks to Andrew for finding this and providing an initial fix.
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 07693198
......@@ -1344,6 +1344,7 @@ int __xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
xfrm_nr += pols[0]->xfrm_nr;
switch (policy->action) {
default:
case XFRM_POLICY_BLOCK:
/* Prohibit the flow */
err = -EPERM;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册