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: 858566 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zH1Qm3hfzz9s7g for ; Thu, 11 Jan 2018 07:52:00 +1100 (AEDT) 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 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 "