aboutsummaryrefslogtreecommitdiff
path: root/sys/netsmb
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2012-06-13 22:12:10 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2012-06-13 22:12:10 +0000
commit620216725a3772c20d092e0eacbfd84b7221b838 (patch)
treeb96b78e408d13c812513bee0b944fc3cdc587057 /sys/netsmb
parenteb5557858277f186c460d978377f67f19889eff1 (diff)
downloadsrc-620216725a3772c20d092e0eacbfd84b7221b838.tar.gz
src-620216725a3772c20d092e0eacbfd84b7221b838.zip
When checking if file descriptor number is valid, explicitely check for 'fd'
being less than 0 instead of using cast-to-unsigned hack. Today's commit was brought to you by the letters 'B', 'D' and 'E' :)
Notes
Notes: svn path=/head/; revision=237036
Diffstat (limited to 'sys/netsmb')
-rw-r--r--sys/netsmb/smb_dev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c
index 6867804f57d9..86b27533f213 100644
--- a/sys/netsmb/smb_dev.c
+++ b/sys/netsmb/smb_dev.c
@@ -375,7 +375,7 @@ nsmb_getfp(struct filedesc* fdp, int fd, int flag)
struct file* fp;
FILEDESC_SLOCK(fdp);
- if (((u_int)fd) >= fdp->fd_nfiles ||
+ if (fd < 0 || fd >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[fd]) == NULL ||
(fp->f_flag & flag) == 0) {
FILEDESC_SUNLOCK(fdp);