Skip to content
Snippets Groups Projects
Commit 4fcb2c2a authored by Bobi Jam's avatar Bobi Jam
Browse files

Branch b1_6

b=13564
i=johann
i=nathan

error handling cleanup.
parent 245741a1
No related branches found
No related tags found
No related merge requests found
...@@ -247,12 +247,12 @@ static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf, ...@@ -247,12 +247,12 @@ static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf,
data->ioc_version = OBD_IOCTL_VERSION; data->ioc_version = OBD_IOCTL_VERSION;
if (*pbuf && data->ioc_len > max) if (*pbuf && data->ioc_len > max)
return 1; return -EINVAL;
if (*pbuf == NULL) { if (*pbuf == NULL) {
*pbuf = malloc(data->ioc_len); *pbuf = malloc(data->ioc_len);
} }
if (!*pbuf) if (!*pbuf)
return 1; return -ENOMEM;
overlay = (struct obd_ioctl_data *)*pbuf; overlay = (struct obd_ioctl_data *)*pbuf;
memcpy(*pbuf, data, sizeof(*data)); memcpy(*pbuf, data, sizeof(*data));
...@@ -266,7 +266,7 @@ static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf, ...@@ -266,7 +266,7 @@ static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf,
if (data->ioc_inlbuf4) if (data->ioc_inlbuf4)
LOGL(data->ioc_inlbuf4, data->ioc_inllen4, ptr); LOGL(data->ioc_inlbuf4, data->ioc_inllen4, ptr);
if (obd_ioctl_is_invalid(overlay)) if (obd_ioctl_is_invalid(overlay))
return 1; return -EINVAL;
return 0; return 0;
} }
......
...@@ -1195,9 +1195,9 @@ int llapi_obd_statfs(char *path, __u32 type, __u32 index, ...@@ -1195,9 +1195,9 @@ int llapi_obd_statfs(char *path, __u32 type, __u32 index,
data.ioc_pbuf2 = (char *)uuid_buf; data.ioc_pbuf2 = (char *)uuid_buf;
data.ioc_plen2 = sizeof(struct obd_uuid); data.ioc_plen2 = sizeof(struct obd_uuid);
if (obd_ioctl_pack(&data, &rawbuf, sizeof(raw))) { if ((rc = obd_ioctl_pack(&data, &rawbuf, sizeof(raw))) != 0) {
fprintf(stderr, "llapi_obd_statfs: error packing ioctl data\n"); fprintf(stderr, "llapi_obd_statfs: error packing ioctl data\n");
return -EINVAL; return rc;
} }
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment