Re: dm raid: pointer math issue in super_sync()

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

 



On Tue, Oct 21, 2014 at 08:48:26AM -0400, Mike Snitzer wrote:
> > -	memset(sb + sizeof(*sb), 0, rdev->sb_size - sizeof(*sb));
> > +	memset(sb + 1, 0, rdev->sb_size - sizeof(*sb));
> >  
> >  	sb->magic = cpu_to_le32(DM_RAID_MAGIC);
> >  	sb->features = cpu_to_le32(0);	/* No features yet */
> 
> Not following... sizeof(*sb) != sizeof(sb).  So I'm not seeing a
> problem.
> 
> Nor am I seeing how you think sb + 1 is equivalent to what Heinz
> intended (zero the memory following the sizeof(struct dm_raid_superblock)).

It's pointer math.

sizeof(*sb) is 512.

"sb + sizeof(*sb)" is the same as (void *)sb + 512 * 512.
"sb + 1" is the same as (void *)sb + 512.

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




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux