提交 6ad37567 编写于 作者: M Martyn Welch 提交者: Greg Kroah-Hartman

vme: vme_get_size potentially returning incorrect value on failure

The function vme_get_size returns the size of the window to the caller,
however it doesn't check the return value of the call to vme_master_get.

Return 0 on failure rather than anything else.
Suggested-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NMartyn Welch <martyn.welch@collabora.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 cfcc1456
...@@ -156,12 +156,16 @@ size_t vme_get_size(struct vme_resource *resource) ...@@ -156,12 +156,16 @@ size_t vme_get_size(struct vme_resource *resource)
case VME_MASTER: case VME_MASTER:
retval = vme_master_get(resource, &enabled, &base, &size, retval = vme_master_get(resource, &enabled, &base, &size,
&aspace, &cycle, &dwidth); &aspace, &cycle, &dwidth);
if (retval)
return 0;
return size; return size;
break; break;
case VME_SLAVE: case VME_SLAVE:
retval = vme_slave_get(resource, &enabled, &base, &size, retval = vme_slave_get(resource, &enabled, &base, &size,
&buf_base, &aspace, &cycle); &buf_base, &aspace, &cycle);
if (retval)
return 0;
return size; return size;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册