From patchwork Wed Jan 10 20:51:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 124134 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5736340qgn; Wed, 10 Jan 2018 12:52:02 -0800 (PST) X-Google-Smtp-Source: ACJfBovUvVJMEqLMTXDRmTbE/kEF8qMgxNmEScpX2mtChE7NiVZJJa/jYnI/CD3gUT5LoVkIFqi/ X-Received: by 10.159.244.8 with SMTP id x8mr20169154plr.24.1515617522481; Wed, 10 Jan 2018 12:52:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515617522; cv=none; d=google.com; s=arc-20160816; b=A0hnm/xjZTSo6415SaE1Qpo3DB3YD7lXBBdf+qqF6IUY3zbqILzpvWcz9qZAdHDLpM VpR8HhEjcJ3WDmqqVK2j/BYJeiGiYJoaFLBDIH9ROfnIFj45sUyU4sgA84/d+xY65oON QrHjS2njYRfM9l3omlQGaCQi0KVVgkOMBE3Mgkv3egAZLMj4SNH/1wzgZWvXAQ5gue09 YAZupdvRsjwi4bnBOXKY+iVfMG+NtPgJdwaVu9NSjPqhzUnpCRtFg81HUKcxkPSC1xTi a3AS8b5jThXIF9ZpyoJMmqfDlWIpGrXN4vQP687GCWW1Z0InEEyXXXkxI2QFo1giwnzG SOIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=rQLCnlEFdlceWehu5R8x3xkv4Lk+bUVctCFpYEbb76g=; b=ci55b3RJRKWV/BREpL5s3A19ptlkYyILMjNdhYc1BesnvRaFLyU4L0xs7xEh9esDuw VM9UX8r6qWh+qaPgDT4j+FzEtcmbevCb0uVKMq9pSBVxVbUlsEu4LE8CSPypBdqz0W5D /fDPiTyRcGv3DEhV+p85QWZE94KayJN0uDbnh9ARnOBs4AggiklXSDc1WNm9HIoxJz16 QM8zdrQ0DeZmLQTtTPznrNttGPJu3flj+u3jdkKVT3b6rKppr8yc1XLR3E5ktBDvELOb g2RE/x5XZwQnsZ7S6prFjVZ392jP0RLDcEi+KH7EOOpDpXdeToinqSzotvCSzl28/TJK Siqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l81si12298605pfb.91.2018.01.10.12.52.02; Wed, 10 Jan 2018 12:52:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752719AbeAJUwA (ORCPT + 28 others); Wed, 10 Jan 2018 15:52:00 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:53649 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbeAJUv6 (ORCPT ); Wed, 10 Jan 2018 15:51:58 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0MMFQL-1eWK0N1Caz-0084St; Wed, 10 Jan 2018 21:51:38 +0100 From: Arnd Bergmann To: Steve French Cc: Arnd Bergmann , Long Li , Pavel Shilovsky , Ronnie Sahlberg , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Subject: [PATCH] CIFS: SMBD: work around gcc -Wmaybe-uninitialized warning Date: Wed, 10 Jan 2018 21:51:05 +0100 Message-Id: <20180110205137.2044979-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:5gvt0IZhJswngY4whXLyXgw6rNc3fxJWnJeDc2FuNvNgy7PN6Lp n53gHZot3xThzH20WdVVd+O5gqblYuZ/wCjjtRDaAN6OfZR8q54o1se4OP7dOtKRJ8pbsDc yhngz+6BBkZvPPJMXOB8U+tAVwcrLYImBX20iWex+THIdj0zSYxW7NOSwYvO5JQGUtdfu0R taDewgWxp6zYL+a4jBJVQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:6lAxoKc713I=:RqVIF1inSh6SJteKpUlcMq YSpP4y0QiyOgjxbCmRuQCbmfSBPhgOqxXH4U88GOoGOqBI8jdXSMCIui8b7v9HDFU9WQHdFgv PVNQcGUmjEAqB4lH39qfeoA/1oqFMA8z0kNmhaQCs/qGwiMizuD9+NdVSfA3fQGWHzEOd7Tev dSgVZUxYoIgywnuOb6QHL4UP5i5IQxM+wd4OU+8uCGXtuKyTqbNuTrUXff+t1kAxl/vxpAINf uE4u3oDfckqzIrz+S7Tt87pclFSzjojkPCO6QyfbqnrOWtDIcm0HaxfcuLkQpkVuMn/RepQR0 eTCj9B71kcfC1uGzdwMNXXuNrRG+6av1DGSspU/f86xAXXhQu4e3kiotSYkY0rReHfUlxU2/J xRLNMI7+5SLrS4EeRQXYXdy5zoRWG22cAGFqXhHXgEKCKnxB1Hl9/7UJzCWkkK5aTSUK/gBxd ITGyElQDzz2bDedIcJtRWXiDpAtDR8tpJ4+ODEt0pNx4CxWkpEVVkk3U3FwWuLoBj9rCfVubn SKJwnjqU5n64M2pU3lBTkwRhT1tQbm0f0qaJlzuWhjKu15Zc8ICJ4tdpWZtVHAaEx16NIkmjD iufryv/TH6L9y2+RP8kbb2QaxIUumy+O3IEs0Dl9kKY/i52ck4BOu2NENzG9jHUembxjRB7Pp kA/IOBOjKiTNq7+9RhWcV0ZrUAaoVp7dL65tmKXNWTTvrazB+4TD276g148OQkJ0KGjNvfziT S/Y/RW7fLnrvTu7+rFQvWcIbivoKtvykqDdnQQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org GCC versions from 4.9 to 6.3 produce a false-positive warning when dealing with a conditional spin_lock_irqsave(): fs/cifs/smbdirect.c: In function 'smbd_recv_buf': include/linux/spinlock.h:260:3: warning: 'flags' may be used uninitialized in this function [-Wmaybe-uninitialized] This function calls some sleeping interfaces, so it is clear that it does not get called with interrupts disabled and there is no need to save the irq state before taking the spinlock. This lets us remove the variable, which makes the function slightly more efficient and avoids the warning. A further cleanup could do the same change for other functions in this file, but I did not want to take this too far for now. Fixes: ac69f66e54ca ("CIFS: SMBD: Implement function to receive data via RDMA receive") Signed-off-by: Arnd Bergmann --- fs/cifs/smbdirect.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 2.9.0 Reviewed-by: Long Li diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index f527e22650f5..f9234ed83a60 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1862,7 +1862,6 @@ int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) int to_copy, to_read, data_read, offset; u32 data_length, remaining_data_length, data_offset; int rc; - unsigned long flags; again: if (info->transport_status != SMBD_CONNECTED) { @@ -1935,15 +1934,13 @@ int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) * end of the queue */ if (!queue_length) - spin_lock_irqsave( - &info->reassembly_queue_lock, - flags); + spin_lock_irq( + &info->reassembly_queue_lock); list_del(&response->list); queue_removed++; if (!queue_length) - spin_unlock_irqrestore( - &info->reassembly_queue_lock, - flags); + spin_unlock_irq( + &info->reassembly_queue_lock); info->count_reassembly_queue--; info->count_dequeue_reassembly_queue++; @@ -1963,10 +1960,10 @@ int smbd_recv_buf(struct smbd_connection *info, char *buf, unsigned int size) to_read, data_read, offset); } - spin_lock_irqsave(&info->reassembly_queue_lock, flags); + spin_lock_irq(&info->reassembly_queue_lock); info->reassembly_data_length -= data_read; info->reassembly_queue_length -= queue_removed; - spin_unlock_irqrestore(&info->reassembly_queue_lock, flags); + spin_unlock_irq(&info->reassembly_queue_lock); info->first_entry_offset = offset; log_read(INFO, "returning to thread data_read=%d "