Skip to content

Commit 6ad3756

Browse files
mwelchukgregkh
authored andcommitted
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 <[email protected]> Signed-off-by: Martyn Welch <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent cfcc145 commit 6ad3756

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/vme/vme.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,16 @@ size_t vme_get_size(struct vme_resource *resource)
156156
case VME_MASTER:
157157
retval = vme_master_get(resource, &enabled, &base, &size,
158158
&aspace, &cycle, &dwidth);
159+
if (retval)
160+
return 0;
159161

160162
return size;
161163
break;
162164
case VME_SLAVE:
163165
retval = vme_slave_get(resource, &enabled, &base, &size,
164166
&buf_base, &aspace, &cycle);
167+
if (retval)
168+
return 0;
165169

166170
return size;
167171
break;

0 commit comments

Comments
 (0)