All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: linux-scsi <linux-scsi@vger.kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Dan Carpenter <error27@gmail.com>,
	"Nicholas A. Bellinger" <nab@linux-iscsi.org>
Subject: [PATCH 02/24] target: fix dubious one-bit signed bitfield
Date: Sat, 29 Jan 2011 10:36:02 -0800	[thread overview]
Message-ID: <1296326184-16664-3-git-send-email-nab@linux-iscsi.org> (raw)
In-Reply-To: <1296326184-16664-1-git-send-email-nab@linux-iscsi.org>

From: Dan Carpenter <error27@gmail.com>

The signed one-bit types can be 0 or -1 which can cause a problem if
someone ever checks if (foo->lu_gp_assoc == 1).  The current code is
fine because everyone just checks zero vs non-zero.  But Sparse
complains about it so lets change it.  The warnings look like this:

include/target/target_core_base.h:228:26: error: dubious one-bit signed bitfield

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
(cherry picked from commit daf0bd7aa57e14b903c81761b421e1130f12b7d1)
---
 include/target/target_core_base.h       |   14 +++++++-------
 include/target/target_core_fabric_ops.h |    2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
index 07fdfb6..764177b 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -225,7 +225,7 @@ struct t10_alua_lu_gp {
 } ____cacheline_aligned;
 
 struct t10_alua_lu_gp_member {
-	int lu_gp_assoc:1;
+	bool lu_gp_assoc;
 	atomic_t lu_gp_mem_ref_cnt;
 	spinlock_t lu_gp_mem_lock;
 	struct t10_alua_lu_gp *lu_gp;
@@ -257,7 +257,7 @@ struct t10_alua_tg_pt_gp {
 } ____cacheline_aligned;
 
 struct t10_alua_tg_pt_gp_member {
-	int tg_pt_gp_assoc:1;
+	bool tg_pt_gp_assoc;
 	atomic_t tg_pt_gp_mem_ref_cnt;
 	spinlock_t tg_pt_gp_mem_lock;
 	struct t10_alua_tg_pt_gp *tg_pt_gp;
@@ -322,7 +322,7 @@ struct t10_pr_registration {
 	int pr_res_type;
 	int pr_res_scope;
 	/* Used for fabric initiator WWPNs using a ISID */
-	int isid_present_at_reg:1;
+	bool isid_present_at_reg;
 	u32 pr_res_mapped_lun;
 	u32 pr_aptpl_target_lun;
 	u32 pr_res_generation;
@@ -404,7 +404,7 @@ struct se_transport_task {
 	unsigned long long	t_task_lba;
 	int			t_tasks_failed;
 	int			t_tasks_fua;
-	int			t_tasks_bidi:1;
+	bool			t_tasks_bidi;
 	u32			t_task_cdbs;
 	u32			t_tasks_check;
 	u32			t_tasks_no;
@@ -456,7 +456,7 @@ struct se_task {
 	u8		task_flags;
 	int		task_error_status;
 	int		task_state_flags;
-	int		task_padded_sg:1;
+	bool		task_padded_sg;
 	unsigned long long	task_lba;
 	u32		task_no;
 	u32		task_sectors;
@@ -569,7 +569,7 @@ struct se_ua {
 struct se_node_acl {
 	char			initiatorname[TRANSPORT_IQN_LEN];
 	/* Used to signal demo mode created ACL, disabled by default */
-	int			dynamic_node_acl:1;
+	bool			dynamic_node_acl;
 	u32			queue_depth;
 	u32			acl_index;
 	u64			num_cmds;
@@ -622,7 +622,7 @@ struct se_lun_acl {
 }  ____cacheline_aligned;
 
 struct se_dev_entry {
-	int			def_pr_registered:1;
+	bool			def_pr_registered;
 	/* See transport_lunflags_table */
 	u32			lun_flags;
 	u32			deve_cmds;
diff --git a/include/target/target_core_fabric_ops.h b/include/target/target_core_fabric_ops.h
index f3ac12b..5eb8b1a 100644
--- a/include/target/target_core_fabric_ops.h
+++ b/include/target/target_core_fabric_ops.h
@@ -8,7 +8,7 @@ struct target_core_fabric_ops {
 	 * for scatterlist chaining using transport_do_task_sg_link(),
 	 * disabled by default
 	 */
-	int task_sg_chaining:1;
+	bool task_sg_chaining;
 	char *(*get_fabric_name)(void);
 	u8 (*get_fabric_proto_ident)(struct se_portal_group *);
 	char *(*tpg_get_wwn)(struct se_portal_group *);
-- 
1.7.3.5


  parent reply	other threads:[~2011-01-29 18:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-29 18:36 [PATCH 00/24] target updates for .38-rc3 (v2) Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 01/24] target: iblock/pscsi claim checking for NULL instead of IS_ERR Nicholas A. Bellinger
2011-01-29 18:36 ` Nicholas A. Bellinger [this message]
2011-01-29 18:36 ` [PATCH 03/24] target/iblock: Fix failed bd claim NULL pointer dereference Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 04/24] target: Fix memory leak on error path Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 05/24] target: Remove unneeded test of se_cmd Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 06/24] target/file: Fix memory leak in fd_set_configfs_dev_params() Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 07/24] target/iblock: Fix memory leak in iblock_set_configfs_dev_params Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 08/24] target: Fix memory leaks in target_core_dev_pr_store_attr_res_aptpl_metadata Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 09/24] target: Fix demo-mode MappedLUN shutdown UA/PR breakage Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 10/24] target: Release left-over demo-mode NodeACLs w/ tfo->tpg_check_demo_mode_cache()=1 Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 11/24] target: tcm_mod_builder.py generated Makefile cleanups Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 12/24] target: do not include target_core_mib.h under include/target Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 13/24] target: remove EXTRA_CFLAGS Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 14/24] target: Call proc_mkdir + remove_proc_entry with NULL parameter Nicholas A. Bellinger
2011-01-29 20:18   ` James Bottomley
2011-01-29 20:43     ` Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 15/24] target: Convert backend ->create_virtdevice() call to return ERR_PTR Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 16/24] target: Drop nacl->device_list_lock on core_update_device_list_for_node failure Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 17/24] target: Remove unnecessary hba_dev_list walk + release from core_delete_hba Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 18/24] target: Remove unnecessary se_clear_dev_ports legacy code Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 19/24] target: Minor sparse warning fixes and annotations Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 20/24] target: Remove spurious double cast from structure macro accessors Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 21/24] target: Convert rd_build_device_space() to use errno Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 22/24] target: Remove unnecessary container_of() pointer check Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 23/24] target: Convert TMR REQ/RSP definitions to target namespace Nicholas A. Bellinger
2011-01-29 18:36 ` [PATCH 24/24] target core v4.0.0-rc7 Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296326184-16664-3-git-send-email-nab@linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=error27@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.