* [PATCH] target, iscsi: Fix up a few assignments
@ 2012-01-15 18:33 Jesper Juhl
2012-01-17 2:30 ` Nicholas A. Bellinger
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2012-01-15 18:33 UTC (permalink / raw)
To: Nicholas A. Bellinger
Cc: target-devel, linux-scsi, linux-kernel, Andy Grover,
Dan Carpenter, Roland Dreier, Christoph Hellwig
A statement such as
struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess);
has undefined behaviour since there are two assignments to 'na', strictly
speaking (the order in which side-effects from the assignments take place
is undefined since there's no intervening sequence point), and it looks
unintentional in any case.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
drivers/target/iscsi/iscsi_target_erl1.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
compile tested only.
diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
index 101b1be..af18cb8 100644
--- a/drivers/target/iscsi/iscsi_target_erl1.c
+++ b/drivers/target/iscsi/iscsi_target_erl1.c
@@ -1238,7 +1238,7 @@ void iscsit_mod_dataout_timer(struct iscsi_cmd *cmd)
{
struct iscsi_conn *conn = cmd->conn;
struct iscsi_session *sess = conn->sess;
- struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess);
+ struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess);
spin_lock_bh(&cmd->dataout_timeout_lock);
if (!(cmd->dataout_timer_flags & ISCSI_TF_RUNNING)) {
@@ -1261,7 +1261,7 @@ void iscsit_start_dataout_timer(
struct iscsi_conn *conn)
{
struct iscsi_session *sess = conn->sess;
- struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess);
+ struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess);
if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING)
return;
--
1.7.8.3
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] target, iscsi: Fix up a few assignments
2012-01-15 18:33 [PATCH] target, iscsi: Fix up a few assignments Jesper Juhl
@ 2012-01-17 2:30 ` Nicholas A. Bellinger
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2012-01-17 2:30 UTC (permalink / raw)
To: Jesper Juhl
Cc: target-devel, linux-scsi, linux-kernel, Andy Grover,
Dan Carpenter, Roland Dreier, Christoph Hellwig
On Sun, 2012-01-15 at 19:33 +0100, Jesper Juhl wrote:
> A statement such as
> struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess);
> has undefined behaviour since there are two assignments to 'na', strictly
> speaking (the order in which side-effects from the assignments take place
> is undefined since there's no intervening sequence point), and it looks
> unintentional in any case.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
> drivers/target/iscsi/iscsi_target_erl1.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> compile tested only.
>
> diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
> index 101b1be..af18cb8 100644
> --- a/drivers/target/iscsi/iscsi_target_erl1.c
> +++ b/drivers/target/iscsi/iscsi_target_erl1.c
> @@ -1238,7 +1238,7 @@ void iscsit_mod_dataout_timer(struct iscsi_cmd *cmd)
> {
> struct iscsi_conn *conn = cmd->conn;
> struct iscsi_session *sess = conn->sess;
> - struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess);
> + struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess);
>
> spin_lock_bh(&cmd->dataout_timeout_lock);
> if (!(cmd->dataout_timer_flags & ISCSI_TF_RUNNING)) {
> @@ -1261,7 +1261,7 @@ void iscsit_start_dataout_timer(
> struct iscsi_conn *conn)
> {
> struct iscsi_session *sess = conn->sess;
> - struct iscsi_node_attrib *na = na = iscsit_tpg_get_node_attrib(sess);
> + struct iscsi_node_attrib *na = iscsit_tpg_get_node_attrib(sess);
>
> if (cmd->dataout_timer_flags & ISCSI_TF_RUNNING)
> return;
> --
Copy and paste error. :(
Applied to lio-core, and thanks for catching this Jesper!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-17 2:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-15 18:33 [PATCH] target, iscsi: Fix up a few assignments Jesper Juhl
2012-01-17 2:30 ` Nicholas A. Bellinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).