Skip to content

Commit

Permalink
Fix overflow check in generic_seek
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodore Dubois committed Nov 13, 2020
1 parent 1e8f71b commit 0728c5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ int generic_seek(struct fd *fd, off_t_ off, int whence, size_t size) {
if (whence == LSEEK_SET) {
fd->offset = off;
} else if (whence == LSEEK_CUR) {
if (!__builtin_add_overflow(new_off, off, &new_off) || new_off < 0)
if (__builtin_add_overflow(new_off, off, &new_off) || new_off < 0)
return _EINVAL;
fd->offset = new_off;
} else if (whence == LSEEK_END) {
Expand Down

0 comments on commit 0728c5e

Please sign in to comment.