diff options
author | Gabriel M. Beddingfield <gabrbedd@ti.com> | 2012-02-08 16:53:32 -0600 |
---|---|---|
committer | Gabriel M. Beddingfield <gabrbedd@ti.com> | 2012-02-08 16:53:32 -0600 |
commit | 80085d470d189362ddb6dda9bba6ee05fe7c84c6 (patch) | |
tree | 492cb767215b3f6675ea9624d0650d57511a9f95 | |
parent | 350211381a270fc6f5e02d3a75cbf6bf99152ec8 (diff) |
pcm: Fix integer size error.
The following code:
while (pcm->boundary * 2 <= LONG_MAX - pcm->buffer_size)
pcm->boundary *= 2;
Creates an infinite loop on systems where LONG_MAX != INT_MAX
(e.g. 64-bit systems). pcm->boundary is an unsigned int, and so
INT_MAX is the proper value to use.
-rw-r--r-- | pcm.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -558,7 +558,7 @@ struct pcm *pcm_open(unsigned int card, unsigned int device, sparams.silence_threshold = config->silence_threshold; pcm->boundary = sparams.boundary = pcm->buffer_size; - while (pcm->boundary * 2 <= LONG_MAX - pcm->buffer_size) + while (pcm->boundary * 2 <= INT_MAX - pcm->buffer_size) pcm->boundary *= 2; if (ioctl(pcm->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sparams)) { |