Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3111268pxj; Mon, 7 Jun 2021 02:33:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfpI6JQePF6feioTJoGUPWbLw9yHoRYV/6w2t5PWqtvpiA8ztjEt1xdqNWfEgCLNNIMyd0 X-Received: by 2002:a17:906:b748:: with SMTP id fx8mr17520737ejb.477.1623058389385; Mon, 07 Jun 2021 02:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623058389; cv=none; d=google.com; s=arc-20160816; b=vQ5UQxZfeocicbnOYXsR+FXE5pS5P8cAaCa7xneno3OfiomZ/U02ieAgkw/0ht7YtW EYXg8pLJQy5cJzNhASutKnXCTSvRFCFOaMJcdNyz/7NJ458OrVt+s93IeWHtYFhAkeYR 9mKuyC5vk9JLARaEjH1OJ49CMwgjyX3Hv+5ZbFSjen4PO2sM/PcJV/n9uWxgDjWgq2OP e9nGAMaHNSXYEztl5C7WM5lMR4coebqkBOY/smM9FMCTao740cIVpah9FpnOPqK1cZJG io/KbjAcLn9CHcMGb2O7k0wYQndJVSPdDfd9xrB37m/EdNUG5uaYcx321ReIJVi0jrTz pJ8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=K8czBL2wzdToEj6Y23/15vfT7f41eICXUYjgoTQ3DMo=; b=LHUbR9up7ZPD+W3DYlUdi8iBChvgEOHeimsSprQCB12UE+1b2ElE6Q5AY7ee9G4Mtg r8yV0VYX/QGn71aaggm+N0t03ku5otaEDqyxuYaKejmApntBBeOiE/irZ9a1KR6PnrQG Rrs1DNm57J0ZtmUX5t5NCw5W0bAzSgeJ0VkB/g3PV+70sA2hSgffpwXLU7dKK47CsGd5 Ceq5I1SXyy5BW3Pu+iExAF0gprgH22eUj8HvTt0WYAyPbNCv2f1jnmNK3KKovSZ4Di1o fY4AZfxd7yDxEmk5EdacHwV/J3MCUZSzEKoK5Mj/m4XUzp8pJ/LLStncpxTILDYXYG8d DYKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=O2vWaKAm; dkim=neutral (no key) header.i=@suse.de header.b=sXCDTXyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f13si12100011edy.493.2021.06.07.02.32.46; Mon, 07 Jun 2021 02:33:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=O2vWaKAm; dkim=neutral (no key) header.i=@suse.de header.b=sXCDTXyS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230353AbhFGJd2 (ORCPT + 99 others); Mon, 7 Jun 2021 05:33:28 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:53694 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230320AbhFGJd1 (ORCPT ); Mon, 7 Jun 2021 05:33:27 -0400 Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0FDDD21A82; Mon, 7 Jun 2021 09:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623058296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=K8czBL2wzdToEj6Y23/15vfT7f41eICXUYjgoTQ3DMo=; b=O2vWaKAm0r/7WnkbgBWwq/g7nRgKc/mm0hzwPfFvCZa3VHhV4J4RboUx1Jwe55X1Ehk1Vg XZd846qbWQYsLZWrmTpJBgeoFbOoL0a1nX7AWwk5p68wUwtN3Y1oHViL2qh/hPGLfeqk4B qVun+gKkJ7pFBaVJvSeh9WEOtGj2KuM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623058296; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=K8czBL2wzdToEj6Y23/15vfT7f41eICXUYjgoTQ3DMo=; b=sXCDTXySeXmlUHPwskff+3cbjM+LU+a/AzpfI97//cQ6Af5ZLKqk/unTyMWPOXGW5LVnNd 6XL7+aEb7HygOTDw== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id EE09FA3B83; Mon, 7 Jun 2021 09:31:35 +0000 (UTC) From: Michal Suchanek To: linux-cifs@vger.kernel.org, Shyam Prasad N Cc: Michal Suchanek , Steve French , samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Subject: [PATCH linux-next] cifs: fix type of chans_need_reconnect on 32bit Date: Mon, 7 Jun 2021 11:31:25 +0200 Message-Id: <20210607093125.3459-1-msuchanek@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 69f98828728f ("cifs: get rid of binding_chan and use chans_need_reconnect instead") uses chans_need_reconnect with test_bit which expects volatile unsigned long but the field is size_t. There are only 16 channels and the variable is assiggned into unsigned long and plain int locals so there is clearly no need for the 64bit precision. Also it could fail quite badly on 32bit bigendian. Fixes: 69f98828728f ("cifs: get rid of binding_chan and use chans_need_reconnect instead") Signed-off-by: Michal Suchanek --- fs/cifs/cifs_debug.c | 2 +- fs/cifs/cifsfs.c | 2 +- fs/cifs/cifsglob.h | 6 +++--- fs/cifs/sess.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index 15635b45af59..9b0f35b7746c 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -425,7 +425,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) from_kuid(&init_user_ns, ses->cred_uid)); if (ses->chan_count > 1) { - seq_printf(m, "\n\n\tExtra Channels: %zu ", + seq_printf(m, "\n\n\tExtra Channels: %lu ", ses->chan_count-1); for (j = 1; j < ses->chan_count; j++) cifs_dump_channel(m, j, &ses->chans[j]); diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 2ffcb29d5c8f..c4baccc14fde 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -684,7 +684,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root) } if (tcon->ses->chan_max > 1) - seq_printf(s, ",multichannel,max_channels=%zu", + seq_printf(s, ",multichannel,max_channels=%lu", tcon->ses->chan_max); if (tcon->use_witness) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8fea2ddd2bd7..96499fc70c82 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -955,8 +955,8 @@ struct cifs_ses { test_bit((index), &(ses)->chans_need_reconnect) struct cifs_chan chans[CIFS_MAX_CHANNELS]; - size_t chan_count; - size_t chan_max; + unsigned long chan_count; + unsigned long chan_max; atomic_t chan_seq; /* round robin state */ /* * chans_need_reconnect is a bitmap indicating which of the channels @@ -968,7 +968,7 @@ struct cifs_ses { * enable the sessions on top to continue to live till any * of the channels below are active. */ - size_t chans_need_reconnect; + unsigned long chans_need_reconnect; }; static inline bool diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 1721a3b24694..9eded8151ae7 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -94,7 +94,7 @@ void cifs_chan_set_need_reconnect(struct cifs_ses *ses, struct TCP_Server_Info *server) { - size_t chan_index = cifs_ses_get_chan_index(ses, server); + unsigned long chan_index = cifs_ses_get_chan_index(ses, server); set_bit(chan_index, &ses->chans_need_reconnect); cifs_dbg(FYI, "Set reconnect bitmask for chan %lu; now 0x%lx\n", chan_index, ses->chans_need_reconnect); @@ -104,7 +104,7 @@ void cifs_chan_clear_need_reconnect(struct cifs_ses *ses, struct TCP_Server_Info *server) { - size_t chan_index = cifs_ses_get_chan_index(ses, server); + unsigned long chan_index = cifs_ses_get_chan_index(ses, server); clear_bit(chan_index, &ses->chans_need_reconnect); cifs_dbg(FYI, "Cleared reconnect bitmask for chan %lu; now 0x%lx\n", chan_index, ses->chans_need_reconnect); @@ -131,7 +131,7 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) if (left <= 0) { cifs_dbg(FYI, - "ses already at max_channels (%zu), nothing to open\n", + "ses already at max_channels (%lu), nothing to open\n", ses->chan_max); return 0; } -- 2.26.2