summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartyn Welch <martyn@welchs.me.uk>2016-10-21 17:36:19 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-28 08:25:18 -0400
commit6ad37567b6b886121e250036e489d82cde5e5e94 (patch)
treeadfaced0a77fe648869c1888ff63cddaff2eabbf
parentcfcc1456e4a2afdca85c7df3baa777f18da1d642 (diff)
downloadlinux-6ad37567b6b886121e250036e489d82cde5e5e94.tar.bz2
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: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/vme/vme.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c
index 15b64076bc26..bdbadaa47ef3 100644
--- a/drivers/vme/vme.c
+++ b/drivers/vme/vme.c
@@ -156,12 +156,16 @@ size_t vme_get_size(struct vme_resource *resource)
case VME_MASTER:
retval = vme_master_get(resource, &enabled, &base, &size,
&aspace, &cycle, &dwidth);
+ if (retval)
+ return 0;
return size;
break;
case VME_SLAVE:
retval = vme_slave_get(resource, &enabled, &base, &size,
&buf_base, &aspace, &cycle);
+ if (retval)
+ return 0;
return size;
break;