From owner-svn-src-all@freebsd.org Tue Aug 30 22:35:47 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B5F8BC9CC0; Tue, 30 Aug 2016 22:35:47 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it0-f47.google.com (mail-it0-f47.google.com [209.85.214.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 870CF287; Tue, 30 Aug 2016 22:35:46 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it0-f47.google.com with SMTP id e124so10761917ith.0; Tue, 30 Aug 2016 15:35:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=UE5AegV/am59jQRvnevAeyTLvEzEpZzeS2ltPzQLKbM=; b=MyjSc5G4Ouj9Ua21jQlJ2ZpDd7JS/jWEpTRsNCMOg6vxsfLll1lml8i+7IybhUjf7W Cmj0SN5QEssixqLaIWEw883mVn0H9J0YGUImalix6m76ecXKdkYAVu/48nZ2BRIUk+d0 nDt6XnylXqbW6qwK/BrVQAdnNjeCZmuu8J8KK6WOVR6wZxON6/geelsLJqM5S4nUNmzJ 6+g9kj74AcKsGxvNwwDLuAysUwMEEVhmM5HKq3sR1U6YxG7rlBitkPFjXCB+7eMW43hM ZvdtnQIfdoAWy896QCjIw3ZJhirakpWisRUQuaw3dQGJ0t7PUMHjPtdQrEbwPqLhDb4y 1rzA== X-Gm-Message-State: AE9vXwPkKTa0D2dnxby+nRKCGKedZ+EkYR0colarC2cGggy8uRWpcb7cXaZrfOAJN41XXw== X-Received: by 10.36.13.203 with SMTP id 194mr25915863itx.79.1472596540676; Tue, 30 Aug 2016 15:35:40 -0700 (PDT) Received: from mail-it0-f54.google.com (mail-it0-f54.google.com. [209.85.214.54]) by smtp.gmail.com with ESMTPSA id z6sm550180ioz.4.2016.08.30.15.35.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Aug 2016 15:35:40 -0700 (PDT) Received: by mail-it0-f54.google.com with SMTP id e124so10761569ith.0; Tue, 30 Aug 2016 15:35:40 -0700 (PDT) X-Received: by 10.36.3.201 with SMTP id e192mr9330198ite.34.1472596540226; Tue, 30 Aug 2016 15:35:40 -0700 (PDT) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.36.220.129 with HTTP; Tue, 30 Aug 2016 15:35:39 -0700 (PDT) In-Reply-To: <201608302148.u7ULmAKm073958@repo.freebsd.org> References: <201608302148.u7ULmAKm073958@repo.freebsd.org> From: Conrad Meyer Date: Tue, 30 Aug 2016 15:35:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r305091 - head/sys/sys To: Mateusz Guzik Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Aug 2016 22:35:47 -0000 On Tue, Aug 30, 2016 at 2:48 PM, Mateusz Guzik wrote: > Author: mjg > Date: Tue Aug 30 21:48:10 2016 > New Revision: 305091 > URL: https://svnweb.freebsd.org/changeset/base/305091 > > Log: > fd: simplify fd testing in fget_locked by casting to u_int > > Modified: > head/sys/sys/filedesc.h > > Modified: head/sys/sys/filedesc.h > ============================================================================== > --- head/sys/sys/filedesc.h Tue Aug 30 21:43:57 2016 (r305090) > +++ head/sys/sys/filedesc.h Tue Aug 30 21:48:10 2016 (r305091) > @@ -201,7 +201,7 @@ fget_locked(struct filedesc *fdp, int fd > > FILEDESC_LOCK_ASSERT(fdp); > > - if (fd < 0 || fd > fdp->fd_lastfile) > + if ((u_int)fd > fdp->fd_lastfile) > return (NULL); > > return (fdp->fd_ofiles[fd].fde_file); > I notice that fd_lastfile is an 'int'. Won't this trigger warnings about the differing signedness of the two sides of the comparison? Should fd_lastfile just be u_int as well? (If not (there is some valid negative value), this change may be invalid.) Best, Conrad