[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM5PR2101MB0918C0F4B89F715C2C643ECBD7790@DM5PR2101MB0918.namprd21.prod.outlook.com>
Date: Sun, 24 Feb 2019 16:54:03 +0000
From: Michael Kelley <mikelley@...rosoft.com>
To: kimbrownkd <kimbrownkd@...il.com>, Long Li <longli@...rosoft.com>,
Sasha Levin <Alexander.Levin@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
Dexuan Cui <decui@...rosoft.com>
CC: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v2 1/2] Drivers: hv: vmbus: Refactor chan->state if
statement
From: Kimberly Brown <kimbrownkd@...il.com> Sent: Thursday, February 21, 2019 7:47 PM
>
> The chan->state "if statement" was introduced in commit 6712cc9c2211
> ("vmbus: don't return values for uninitalized channels"). That commit
> states that the purpose of the chan->state "if statement" is to prevent
> returning garbage or causing a kernel OOPS when the channel ring buffer
> is not initialized. The changes in this patch provide the same
> protection.
>
> Refactor the chan->state “if statement” in vmbus_chan_attr_show():
> - Instead of checking the channel state in the "if statement", check
> whether the channel ring buffer pointer is NULL. Checking the
> ring buffer pointer makes this code consistent with
> hv_ringbuffer_get_debuginfo().
>
> - Move the "if statement" to the four "_show" functions that access a
> channel ring buffer. Only four of the channel-level "_show" functions
> access a ring buffer. The ring buffer pointer does not need to be
> checked before calling the other "_show" functions, and moving the
> ring buffer pointer "if statement" to the "_show" functions that
> access a ring buffer makes the purpose of the "if statement" clear.
>
> Signed-off-by: Kimberly Brown <kimbrownkd@...il.com>
Reviewed-by: Michael Kelley <mikelley@...rosoft.com>
Powered by blists - more mailing lists