Message ID | 1485159923-51866-1-git-send-email-christophe.milard@linaro.org |
---|---|
State | Accepted |
Commit | bbabb79cfaf5e28ec9e804b95a23605038b39d39 |
Headers | show |
On Mon, Jan 23, 2017 at 2:25 AM, Christophe Milard <christophe.milard@linaro.org> wrote: > Hence fixing CID 174663 > (Fixes https://bugs.linaro.org/show_bug.cgi?id=2827) > > Signed-off-by: Christophe Milard <christophe.milard@linaro.org> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> > --- > > since V1: > -print strerror(errno) and sets __odp_errno (Maxim) > -ref to bugzilla bug ID (Mike, Bill) > > platform/linux-generic/_ishm.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c > index f889834..5ca1067 100644 > --- a/platform/linux-generic/_ishm.c > +++ b/platform/linux-generic/_ishm.c > @@ -818,7 +818,14 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, > > /* If a file descriptor is provided, get the real size and map: */ > if (fd >= 0) { > - fstat(fd, &statbuf); > + if (fstat(fd, &statbuf) < 0) { > + close(fd); > + odp_spinlock_unlock(&ishm_tbl->lock); > + ODP_ERR("_ishm_reserve failed (fstat failed: %s).\n", > + strerror(errno)); > + __odp_errno = errno; > + return -1; > + } > len = statbuf.st_size; > /* note that the huge page flag is meningless here as huge > * page is determined by the provided file descriptor: */ > -- > 2.7.4 >
Merged, Maxim. On 01/25/17 05:33, Bill Fischofer wrote: > On Mon, Jan 23, 2017 at 2:25 AM, Christophe Milard > <christophe.milard@linaro.org> wrote: >> Hence fixing CID 174663 >> (Fixes https://bugs.linaro.org/show_bug.cgi?id=2827) >> >> Signed-off-by: Christophe Milard <christophe.milard@linaro.org> > > Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org> > >> --- >> >> since V1: >> -print strerror(errno) and sets __odp_errno (Maxim) >> -ref to bugzilla bug ID (Mike, Bill) >> >> platform/linux-generic/_ishm.c | 9 ++++++++- >> 1 file changed, 8 insertions(+), 1 deletion(-) >> >> diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c >> index f889834..5ca1067 100644 >> --- a/platform/linux-generic/_ishm.c >> +++ b/platform/linux-generic/_ishm.c >> @@ -818,7 +818,14 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, >> >> /* If a file descriptor is provided, get the real size and map: */ >> if (fd >= 0) { >> - fstat(fd, &statbuf); >> + if (fstat(fd, &statbuf) < 0) { >> + close(fd); >> + odp_spinlock_unlock(&ishm_tbl->lock); >> + ODP_ERR("_ishm_reserve failed (fstat failed: %s).\n", >> + strerror(errno)); >> + __odp_errno = errno; >> + return -1; >> + } >> len = statbuf.st_size; >> /* note that the huge page flag is meningless here as huge >> * page is determined by the provided file descriptor: */ >> -- >> 2.7.4 >>
diff --git a/platform/linux-generic/_ishm.c b/platform/linux-generic/_ishm.c index f889834..5ca1067 100644 --- a/platform/linux-generic/_ishm.c +++ b/platform/linux-generic/_ishm.c @@ -818,7 +818,14 @@ int _odp_ishm_reserve(const char *name, uint64_t size, int fd, /* If a file descriptor is provided, get the real size and map: */ if (fd >= 0) { - fstat(fd, &statbuf); + if (fstat(fd, &statbuf) < 0) { + close(fd); + odp_spinlock_unlock(&ishm_tbl->lock); + ODP_ERR("_ishm_reserve failed (fstat failed: %s).\n", + strerror(errno)); + __odp_errno = errno; + return -1; + } len = statbuf.st_size; /* note that the huge page flag is meningless here as huge * page is determined by the provided file descriptor: */
Hence fixing CID 174663 (Fixes https://bugs.linaro.org/show_bug.cgi?id=2827) Signed-off-by: Christophe Milard <christophe.milard@linaro.org> --- since V1: -print strerror(errno) and sets __odp_errno (Maxim) -ref to bugzilla bug ID (Mike, Bill) platform/linux-generic/_ishm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.7.4