From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752235AbeAJVz4 (ORCPT + 1 other); Wed, 10 Jan 2018 16:55:56 -0500 Received: from mail-bn3nam01on0131.outbound.protection.outlook.com ([104.47.33.131]:58152 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751333AbeAJVzy (ORCPT ); Wed, 10 Jan 2018 16:55:54 -0500 From: Long Li To: Arnd Bergmann , Steve French CC: Pavel Shilovskiy , Ronnie Sahlberg , "linux-cifs@vger.kernel.org" , "samba-technical@lists.samba.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] CIFS: SMBD: work around gcc -Wmaybe-uninitialized warning Thread-Topic: [PATCH] CIFS: SMBD: work around gcc -Wmaybe-uninitialized warning Thread-Index: AQHTilTSG+QRwfyabUC5tbpaDYTnS6Ntplvg Date: Wed, 10 Jan 2018 21:55:48 +0000 Message-ID: References: <20180110205137.2044979-1-arnd@arndb.de> In-Reply-To: <20180110205137.2044979-1-arnd@arndb.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [2001:4898:80e8:8::2e0] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MWHPR21MB0191;6:e+AZfLizkMOfFuGxfoyzltmsNM/+EQNtlD3fHOps8MOCkBuY0Jk/iimEu7GtngRU9k4GDkiJaxtk1fdspT97QLYDUSpGQRx5GDyo9H/Yq8qDXBj0SJgjROPQUWn3XQJ3OaFP/+DncPalauf3/VwW+3uYF2XH6cL1d9H2VCGvwl7CuMV0AFL8rHiqg0oBe1IPFaeP3/2jvX96Bv5KKyab3+Lc22M/ubKz4ofPABmnHcF/JlCYqQTqH7HcYQtlwU67fL93RBKYvwkb+RVJuhkuf+s8wVJkzhiywPfmjUEpYt1XnqROARHHjn7NGpXhMraHncYEuSrBGkP7+7aQ7vUoN7JiePuCRQI7785ADdqbCeRn2GplCrZ+pn6gQUmpoXnn;5:4PGnmmkA3eZYMgakRqn1S9kuaxOgZz36MTHqP4648nPSuP4sIP/cdiK3Zyb1ndQgX8n5UOvcrDDw5gpG8E+oYTulE9H7jLqFWsPEsakMcljwB+vQ6+CNlnSiM0rPdLiIbFBcI+6ovcIs5ydL8JD5oI8R7U+CHSGE4s9FOJ25Boc=;24:wSWG9if6+doUHbTG4+/P6GdH1F/3K7yKGI/XT7a++bZN+TAZciDYAq6gC6B/bMwSYMxDJixy5x9dF5QGe+IAFxtvQra84/mHVUqqyO8LZgE=;7:7RKsGQnKde7Ez9lvd7DqoGk60QubZzZQrFYI6FReeUpSwkZcWuDR7IY1Le3AyTckT5GP/AZJPYWDHY72C+Us5vrbsGrIoikhbRi6qrcXen0j7Nn6o8duqR0pU6zbbbPkPDlzpaRF2DhJMjHEMR6y6OyVg08qdujJOCc6gkdn41mX7j04nYuLZfx2QMWfaPObP76CC3zD+BmzUE3puaci5XRQ5aV2MrtV/VdYVEGsGrh7ViX2z87Gb1kiAPk7ZGv4 x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10019020)(396003)(346002)(39380400002)(366004)(376002)(39860400002)(189003)(199004)(74316002)(105586002)(4326008)(2950100002)(7736002)(106356001)(5660300001)(55016002)(33656002)(10090500001)(8990500004)(9686003)(25786009)(305945005)(2900100001)(5250100002)(86612001)(6436002)(53936002)(6246003)(229853002)(3660700001)(68736007)(10290500003)(86362001)(3280700002)(478600001)(76176011)(7696005)(316002)(81166006)(110136005)(54906003)(97736004)(8936002)(99286004)(59450400001)(81156014)(8676002)(14454004)(102836004)(6116002)(6506007)(2906002)(22452003);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR21MB0191;H:MWHPR21MB0846.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-correlation-id: 7c1e0778-df10-4798-2d21-08d55874e881 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020056)(4652020)(5600026)(4604075)(3008032)(4534086)(4602075)(4627182)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:MWHPR21MB0191; x-ms-traffictypediagnostic: MWHPR21MB0191: authentication-results: spf=none (sender IP is ) smtp.mailfrom=longli@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040470)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231023)(944501124)(6055026)(61426038)(61427038)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:MWHPR21MB0191;BCL:0;PCL:0;RULEID:(100000803126)(100110400120);SRVR:MWHPR21MB0191; x-forefront-prvs: 0548586081 x-microsoft-antispam-message-info: KyftQ29K8zLOu0ZNcbFA9MmeLjvUslPbeioX1zXrGiBxxw36GDK2TT5He0W1JV4jOKvHSNx/Ldwo9lFsc3q33g== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c1e0778-df10-4798-2d21-08d55874e881 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2018 21:55:48.1802 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0191 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: > 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 " > -- > 2.9.0