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: 10156089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 94EFE60223 for ; Wed, 10 Jan 2018 20:52:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84A5F285DC for ; Wed, 10 Jan 2018 20:52:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7916A285E4; Wed, 10 Jan 2018 20:52:00 +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=-6.9 required=2.0 tests=BAYES_00,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 0951D285DC for ; Wed, 10 Jan 2018 20:52:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752135AbeAJUv7 (ORCPT ); Wed, 10 Jan 2018 15:51:59 -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-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Long Li --- fs/cifs/smbdirect.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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 "