Re: [PATCH] i40iw: pass hw_stats by reference rather than by value

2016-03-28 Thread Chien Tin Tung
On Mon, Mar 28, 2016 at 12:14:46PM +0100, Colin King wrote:
> From: Colin Ian King 
> 
> passing hw_stats by value requires a 280 byte copy so instead
> pass it by reference is much more efficient.
> 
> Signed-off-by: Colin Ian King 

Thank you for the patch Colin.

Acked-by: Chien Tin Tung 


Re: [infiniband-hw-i40iw] question about identical code for different branches

2017-05-18 Thread Chien Tin Tung
 Thu, May 18, 2017 at 08:00:29AM +0300, Leon Romanovsky wrote:
> On Wed, May 17, 2017 at 05:06:54PM -0500, Gustavo A. R. Silva wrote:
> >
> > Hello everybody,
> >
> > While looking into Coverity ID 1362263 I ran into the following piece of
> > code at drivers/infiniband/hw/i40iw/i40iw_virtchnl.c:445:
> >
> > 445if (vchnl_msg->iw_op_code == I40IW_VCHNL_OP_GET_VER) {
> > 446if (vchnl_msg->iw_op_ver != I40IW_VCHNL_OP_GET_VER_V0)
> > 447vchnl_pf_send_get_ver_resp(dev, vf_id, 
> > vchnl_msg);
> > 448else
> > 449vchnl_pf_send_get_ver_resp(dev, vf_id, 
> > vchnl_msg);
> > 450return I40IW_SUCCESS;
> > 451}
> >
> > The issue is that lines of code 447 and 449 are identical for different
> > branches.
> >
> > My question here is if one of the branches should be modified, or the entire
> > _if_ statement replaced?
> >
> > Maybe a patch like the following could be applied:
> 
> It looks like that you can replace I40IW_VCHNL_OP_GET_VER_V0 with
> I40IW_VCHNL_OP_GET_VER and get rid of all places with
> I40IW_VCHNL_OP_GET_VER_V0.

No. I40IW_VCHNL_OP_GET_VER is iw_op_code and I40IW_VCHNL_OP_GET_VER_V0 is
iw_op_ver two different things.

Chien


Re: [PATCH][V2] RDMA/nes: do not leak uninitialized resp.reserved to userspace Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit

2017-09-05 Thread Chien Tin Tung
On Mon, Sep 04, 2017 at 02:37:05PM +0100, Colin King wrote:
> From: Colin Ian King 
> 
> resp.reserved has not been initialized and so the copy_to_user (via
> ib_copy_to_udata) is copying uninitialized data from the stack back
> to user space which is a potential information leak. Fix this by
> initializing all of resp to zero.

Reserved field is not copied as the length of reserved is subtracted
from the size of resp and passed to ib_copy_to_udata.

 if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) {


This patch is not necessary.

Chien