From patchwork Wed Nov 14 07:40:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10681977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 390951759 for ; Wed, 14 Nov 2018 07:40:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BF372AE85 for ; Wed, 14 Nov 2018 07:40:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FE372B0FA; Wed, 14 Nov 2018 07:40:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2CFB2AE85 for ; Wed, 14 Nov 2018 07:40:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727375AbeKNRmn (ORCPT ); Wed, 14 Nov 2018 12:42:43 -0500 Received: from mail-pl1-f181.google.com ([209.85.214.181]:38629 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727154AbeKNRmn (ORCPT ); Wed, 14 Nov 2018 12:42:43 -0500 Received: by mail-pl1-f181.google.com with SMTP id p4-v6so7367379plo.5 for ; Tue, 13 Nov 2018 23:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Mzut1LdAChyqYMJH9Ro+5bLA5K5BQ+nZGL7uscX4s9w=; b=idEAYM0nBmDg9kshdSBFmvLiYWbP+R3ioYFpIVttweDtHe+Ji7cToXxQrZe9o2KPWe Yu4BlD4PzKa8pNaNIA84EKl+UVwwTU1gA38nRp9HFJQj1XuoOa6RPRcU4x16veoS2bS7 ES7BKEIGh3zCHT2eNxYtkWIUSOPUCCDfgA0kSRsVl4m/a6hAegPMCtb1CNIQkA5jzf/V KaDHTna0CblF77GvZ6mIjpyfoJaScH6m9geR+bmIbr9LXhKmjhW1xCv3RKlJNbLtp0JB xjaXKNawFxdg0xsmLa/4ptm85nzmfLHXTzQdKg2t+gBw94y/f9RQGeD1xfr/NOXP8Oz5 oN6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Mzut1LdAChyqYMJH9Ro+5bLA5K5BQ+nZGL7uscX4s9w=; b=N/pu3T1QQ0znbXYdtYIPZJAiTSPHu58N3vaZeVKWfztExfLoMeYNLLfQmzeJp45pAj wg4vGIPvXnMNYJSnuMsKn8DJCt4JFDVLm2/e3sE8VfNEQLK7auqoPbjGtPVDReQEntwm hyorcCU0+H1w4VnUlJFj7YI0pLgl+NrBtAAYK1eiHbCZGVWkd2VDIAPNYAv3xT70CmmS cnrRZl7EyhFqOxBHNw0ecP6qn2BFIBrjnkP2i11yXQoIvaUz61iEay5gozKJv9Zj1+16 nao/tvlKiKkANFyc2kcgRVfaRTKYPa+8erBcF7FwnNwPoHjCL0rpgmPaf7PHoZO77FSt HQzQ== X-Gm-Message-State: AGRZ1gK3B+WDNXKhHKOFKqFRz42AtmUi/MzGJNWvkhYERWaJdj4yt6Y0 cqYmofTG+/cGOr/dWrG+Em+AjVyDlGm/cfSGfm31kDV+ X-Google-Smtp-Source: AJdET5chUIKGDG8xrwm0fGvgYpSmuZ5kBWRGVaauVOq+yiM5xIy/P3DEg4AK4fBIEWmMXesARprEPe9cAVwbAVQg8l8= X-Received: by 2002:a17:902:3103:: with SMTP id w3-v6mr891658plb.18.1542181238865; Tue, 13 Nov 2018 23:40:38 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Wed, 14 Nov 2018 01:40:27 -0600 Message-ID: Subject: Minor fix for problem noted by coverity scan To: CIFS Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reviewed-by: Ronnie Sahlberg Reviewed-by: Ronnie Sahlberg From 530a883f45658d1590d3503d73c6f7dfa283f412 Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 14 Nov 2018 01:37:39 -0600 Subject: [PATCH] cifs: smb2 commands can not be negative, remove confusing check As Coverity points out le16_to_cpu(midEntry->Command) can not be less than zero. Detected by CoverityScan, CID#1438650 ("Macro compares unsigned to 0") Signed-off-by: Steve French --- fs/cifs/transport.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 83ff0c25710d..5be7302853b6 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -126,9 +126,11 @@ DeleteMidQEntry(struct mid_q_entry *midEntry) if ((slow_rsp_threshold != 0) && time_after(now, midEntry->when_alloc + (slow_rsp_threshold * HZ)) && (midEntry->command != command)) { - /* smb2slowcmd[NUMBER_OF_SMB2_COMMANDS] counts by command */ - if ((le16_to_cpu(midEntry->command) < NUMBER_OF_SMB2_COMMANDS) && - (le16_to_cpu(midEntry->command) >= 0)) + /* + * smb2slowcmd[NUMBER_OF_SMB2_COMMANDS] counts by command + * NB: le16_to_cpu returns unsigned so can not be negative below + */ + if (le16_to_cpu(midEntry->command) < NUMBER_OF_SMB2_COMMANDS) cifs_stats_inc(&midEntry->server->smb2slowcmd[le16_to_cpu(midEntry->command)]); trace_smb3_slow_rsp(le16_to_cpu(midEntry->command), -- 2.17.1