From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751413Ab2AQCaH (ORCPT ); Mon, 16 Jan 2012 21:30:07 -0500 Received: from mail.linux-iscsi.org ([67.23.28.174]:36486 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750857Ab2AQCaD (ORCPT ); Mon, 16 Jan 2012 21:30:03 -0500 Subject: Re: [PATCH] target, iscsi: Fix up a few assignments From: "Nicholas A. Bellinger" To: Jesper Juhl Cc: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Grover , Dan Carpenter , Roland Dreier , Christoph Hellwig In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Mon, 16 Jan 2012 18:30:01 -0800 Message-ID: <1326767401.3600.41.camel@haakon2.linux-iscsi.org> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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!