lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1232137717.3224.54.camel@localhost.localdomain>
Date:	Fri, 16 Jan 2009 15:28:37 -0500
From:	James Bottomley <James.Bottomley@...senPartnership.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	torvalds@...ux-foundation.org, linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [GIT PATCH] firs round of SCSI bug fixes for 2.6.29-rc1

On Fri, 2009-01-16 at 11:07 -0800, Andrew Morton wrote:
> On Fri, 16 Jan 2009 13:48:53 -0500
> James Bottomley <James.Bottomley@...senPartnership.com> wrote:
> 
> > > > +++ b/drivers/scsi/qla2xxx/qla_init.c
> > > > @@ -1258,35 +1258,48 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
> > > >  {
> > > >  	int	rval;
> > > >  	unsigned long flags = 0;
> > > > -	int cnt;
> > > > +	int cnt, que;
> > > >  	struct qla_hw_data *ha = vha->hw;
> > > > -	struct req_que *req = ha->req_q_map[0];
> > > > -	struct rsp_que *rsp = ha->rsp_q_map[0];
> > > > +	struct req_que *req;
> > > > +	struct rsp_que *rsp;
> > > > +	struct scsi_qla_host *vp;
> > > >  	struct mid_init_cb_24xx *mid_init_cb =
> > > >  	    (struct mid_init_cb_24xx *) ha->init_cb;
> > > 
> > > This cast worries me.  It's a cast between two complex data structures
> > > which appear to have nothing to do with each other.
> > 
> > Actually, it's a C++ type construct.  ha->init_cb is of type init_cb_t,
> > mid_init_cb actually contains this (via a second indirection) as the
> > first element, so what it's doing is dynamically casting out based on
> > the board type.
> 
> Ah, OK, I got lost amongst the typedefs and pointers.
> 
> This code could/should use container_of() for this operation?

It could, but since it's a double cast out it would get a lot uglier. We
don't really pick up any safety from this because the FW structure is
shared with the device, so no-one can move the first element anyway.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ