Commit e1f50f5c authored by Linus Torvalds's avatar Linus Torvalds

Avoid compiler warning by using the proper types in "min()".

parent ff69e5d9
...@@ -180,7 +180,7 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer, ...@@ -180,7 +180,7 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer,
snd_info_private_data_t *data; snd_info_private_data_t *data;
struct snd_info_entry *entry; struct snd_info_entry *entry;
snd_info_buffer_t *buf; snd_info_buffer_t *buf;
long size = 0; size_t size = 0;
data = snd_magic_cast(snd_info_private_data_t, file->private_data, return -ENXIO); data = snd_magic_cast(snd_info_private_data_t, file->private_data, return -ENXIO);
snd_assert(data != NULL, return -ENXIO); snd_assert(data != NULL, return -ENXIO);
...@@ -192,7 +192,8 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer, ...@@ -192,7 +192,8 @@ static ssize_t snd_info_entry_read(struct file *file, char *buffer,
return -EIO; return -EIO;
if (file->f_pos >= (long)buf->size) if (file->f_pos >= (long)buf->size)
return 0; return 0;
size = min(count, buf->size - file->f_pos); size = buf->size - file->f_pos;
size = min(count, size);
if (copy_to_user(buffer, buf->buffer + file->f_pos, size)) if (copy_to_user(buffer, buf->buffer + file->f_pos, size))
return -EFAULT; return -EFAULT;
file->f_pos += size; file->f_pos += size;
...@@ -213,7 +214,7 @@ static ssize_t snd_info_entry_write(struct file *file, const char *buffer, ...@@ -213,7 +214,7 @@ static ssize_t snd_info_entry_write(struct file *file, const char *buffer,
snd_info_private_data_t *data; snd_info_private_data_t *data;
struct snd_info_entry *entry; struct snd_info_entry *entry;
snd_info_buffer_t *buf; snd_info_buffer_t *buf;
long size = 0; size_t size = 0;
data = snd_magic_cast(snd_info_private_data_t, file->private_data, return -ENXIO); data = snd_magic_cast(snd_info_private_data_t, file->private_data, return -ENXIO);
snd_assert(data != NULL, return -ENXIO); snd_assert(data != NULL, return -ENXIO);
...@@ -227,7 +228,8 @@ static ssize_t snd_info_entry_write(struct file *file, const char *buffer, ...@@ -227,7 +228,8 @@ static ssize_t snd_info_entry_write(struct file *file, const char *buffer,
return -EINVAL; return -EINVAL;
if (file->f_pos >= (long)buf->len) if (file->f_pos >= (long)buf->len)
return -ENOMEM; return -ENOMEM;
size = min(count, buf->len - file->f_pos); size = buf->len - file->f_pos;
size = min(count, size);
if (copy_from_user(buf->buffer + file->f_pos, buffer, size)) if (copy_from_user(buf->buffer + file->f_pos, buffer, size))
return -EFAULT; return -EFAULT;
if ((long)buf->size < file->f_pos + size) if ((long)buf->size < file->f_pos + size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment