提交 36a6bd01 编写于 作者: N Nicholas Mc Guire 提交者: Xie XiuQi

staging: vc04_services: handle kzalloc failure

[ Upstream commit a5112277872a56017b777770e2fd4324d4a6c866 ]

The kzalloc here was being used without checking the return - if the
kzalloc fails return VCHIQ_ERROR. The call-site of
vchiq_platform_init_state() vchiq_init_state() was not responding
to an allocation failure so checks for != VCHIQ_SUCCESS
and pass VCHIQ_ERROR up to vchiq_platform_init() which then
will fail with -EINVAL.
Signed-off-by: NNicholas Mc Guire <hofrat@osadl.org>
Reported-by: Nkbuild test robot <lkp@intel.com>
Acked-By: NStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 ffc10fd4
......@@ -208,6 +208,9 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)
struct vchiq_2835_state *platform_state;
state->platform_state = kzalloc(sizeof(*platform_state), GFP_KERNEL);
if (!state->platform_state)
return VCHIQ_ERROR;
platform_state = (struct vchiq_2835_state *)state->platform_state;
platform_state->inited = 1;
......
......@@ -2537,6 +2537,8 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero,
local->debug[DEBUG_ENTRIES] = DEBUG_MAX;
status = vchiq_platform_init_state(state);
if (status != VCHIQ_SUCCESS)
return VCHIQ_ERROR;
/*
bring up slot handler thread
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册