From 167946400c601add27d0f93ebb7d7561e42413cc Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 31 Aug 2014 19:49:08 -0300 Subject: [PATCH] libdvbv5: Rename internally-defined poll function as dvb_poll poll() is the name of a glibc function. Rename it as dvb_poll(). That should likely fix a Coverity warning: 278 do { >>> CID 1233564: Out-of-bounds access (ARRAY_VS_SINGLETON) >>> Passing "&parms->p" to function "poll" which uses it as an array. This might corrupt or misinterpret adjacent memory locations. [Note: The source code implementation of the function has been overridden by a builtin model.] 279 available = poll(&parms->p, dmx_fd, timeout); 280 } while (available < 0 && errno == EOVERFLOW); Also, as this function is static, use the private struct directly. Signed-off-by: Mauro Carvalho Chehab --- lib/libdvbv5/dvb-scan.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c index ad88d32..cf540c3 100644 --- a/lib/libdvbv5/dvb-scan.c +++ b/lib/libdvbv5/dvb-scan.c @@ -62,7 +62,7 @@ #include #include -static int poll(struct dvb_v5_fe_parms *parms, int fd, unsigned int seconds) +static int dvb_poll(struct dvb_v5_fe_parms_priv *parms, int fd, unsigned int seconds) { fd_set set; struct timeval timeout; @@ -78,7 +78,7 @@ static int poll(struct dvb_v5_fe_parms *parms, int fd, unsigned int seconds) /* `select' logfuncreturns 0 if timeout, 1 if input available, -1 if error. */ do ret = select (FD_SETSIZE, &set, NULL, NULL, &timeout); - while (!parms->abort && ret == -1 && errno == EINTR); + while (!parms->p.abort && ret == -1 && errno == EINTR); return ret; } @@ -276,7 +276,7 @@ int dvb_read_sections(struct dvb_v5_fe_parms *__p, int dmx_fd, ssize_t buf_length = 0; do { - available = poll(&parms->p, dmx_fd, timeout); + available = dvb_poll(parms, dmx_fd, timeout); } while (available < 0 && errno == EOVERFLOW); if (parms->p.abort) { -- 2.7.4