Quiet compiler warnings for fget_noref and fdget_noref
Summary: Typecasting both parts of the comparison to u_int quiets compiler warnings about signed/unsigned comparison and takes care of positive and negative numbers for the file descriptor in a single comparison. Obtained from: Juniper Netwowrks, Inc. Reviewers: mjg Subscribers: imp Differential Revision: https://reviews.freebsd.org/D39593
This commit is contained in:
parent
0ab68e9272
commit
b1a00c2b13
@ -303,7 +303,7 @@ fget_noref(struct filedesc *fdp, int fd)
|
||||
|
||||
FILEDESC_LOCK_ASSERT(fdp);
|
||||
|
||||
if (__predict_false((u_int)fd >= fdp->fd_nfiles))
|
||||
if (__predict_false((u_int)fd >= (u_int)fdp->fd_nfiles))
|
||||
return (NULL);
|
||||
|
||||
return (fdp->fd_ofiles[fd].fde_file);
|
||||
@ -316,7 +316,7 @@ fdeget_noref(struct filedesc *fdp, int fd)
|
||||
|
||||
FILEDESC_LOCK_ASSERT(fdp);
|
||||
|
||||
if (__predict_false((u_int)fd >= fdp->fd_nfiles))
|
||||
if (__predict_false((u_int)fd >= (u_int)fdp->fd_nfiles))
|
||||
return (NULL);
|
||||
|
||||
fde = &fdp->fd_ofiles[fd];
|
||||
|
Loading…
Reference in New Issue
Block a user