[Cbe-oss-dev] [PATCH] libspe2 add assist calls for pread, pwrite, readv and writev
Kazunori Asayama
asayama at sm.sony.co.jp
Fri Jun 22 16:32:20 EST 2007
Patrick Mansfield <patmans at us.ibm.com> wrote:
> Add assist calls for:
>
> ssize_t pread(int fd, void *buf, size_t count, off_t offset)
> ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset)
> ssize_t readv(int fd, const struct iovec *vector, int count)
> ssize_t writev(int fd, const struct iovec *vector, int count)
(snip)
> +int default_posix1_handler_readv(char *ls, unsigned long opdata)
> +{
> + DECL_3_ARGS();
> + DECL_RET();
> + int fd;
> + struct iovec vec[IOV_MAX];
> + struct ls_iovec *lsvec;
> + size_t count;
> + int rc;
> +
> + DEBUG_PRINTF("%s\n", __func__);
> + fd = arg0->slot[0];
> + lsvec = GET_LS_PTR(arg1->slot[0]);
> + count = arg2->slot[0];
> + rc = check_conv_spuvec(ls, vec, lsvec, count);
To avoid buffer overrun, the value of 'count' should be checked before
calling check_conv_spuvec, or 'vec' should be dynamically allocated.
(snip)
> +int default_posix1_handler_writev(char *ls, unsigned long opdata)
> +{
> + DECL_3_ARGS();
> + DECL_RET();
> + int fd;
> + struct iovec vec[IOV_MAX];
> + struct ls_iovec *lsvec;
> + size_t count;
> + int rc;
> +
> + DEBUG_PRINTF("%s\n", __func__);
> + fd = arg0->slot[0];
> + lsvec = GET_LS_PTR(arg1->slot[0]);
> + count = arg2->slot[0];
> + rc = check_conv_spuvec(ls, vec, lsvec, count);
Ditto.
--
(ASAYAMA Kazunori
(asayama at sm.sony.co.jp))
t
More information about the cbe-oss-dev
mailing list