Re: [PATCH 4/4] target: remove useless casts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2011-11-28 at 01:05 -0800, Nicholas A. Bellinger wrote:
> On Thu, 2011-11-24 at 02:05 +0100, Jörn Engel wrote:
> > A reader should spend an extra moment whenever noticing a cast.

> 
> > @@ -821,6 +820,7 @@ int iscsi_target_setup_login_socket(
> >  	/*
> >  	 * Set SO_REUSEADDR, and disable Nagel Algorithm with TCP_NODELAY.
> >  	 */
> > +	/* FIXME: Someone please explain why this is endian-safe */
> >  	opt = 1;
> >  	if (np->np_network_transport == ISCSI_TCP) {
> >  		ret = kernel_setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
> > @@ -832,6 +832,7 @@ int iscsi_target_setup_login_socket(
> >  		}
> >  	}
> >  
> > +	/* FIXME: Someone please explain why this is endian-safe */
> >  	ret = kernel_setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
> >  			(char *)&opt, sizeof(opt));
> >  	if (ret < 0) {
> 
> Another good catch.  Changing opt to be a single char value with
> kernel_setsockopt().
> 
> Thanks Joern!
> 

Hey Joern,

Sorry, my last change here to use a single char actually actually broke
iscsi-target in lio-core, so reverting this for the moment.

All of the other net/ users of kernel_setsockopt() seem to be doing the
same thing with int when enabling a '1' value opt.  Is the caller really
not endian safe here..?  I don't recall having an issue with big-endian
here in the recent past, but i'll look at this with pseries soon to
double check since it's been mentioned.

Thanks,

--nab


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux