Re: libsrp, srp_target_alloc() and srp_target_free()

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

 



On Sun, 6 Dec 2009 11:18:13 +0100
Bart Van Assche <bart.vanassche@xxxxxxxxx> wrote:

> There is an asymmetry between the libsrp functions srp_target_alloc()
> and srp_target_free(): the former sets the pointer to driver-private
> data by invoking dev_set_drvdata() while the latter does not clear
> this pointer. So once srp_target_free() finished invoking
> dev_get_drvdata() will return a dangling pointer. Would it be a good
> idea to add the following statement inside srp_target_free() just
> before this function returns ?
> 
> dev_set_drvdata(target->dev, NULL);

It's fine by me but I don't see any point.

For me, it's pretty clear that you can't use a pointer to something
after freeing it.

struct srp_target *target;

target = dev_get_drvdata(&dev->dev);
srp_target_free(target);

Then you want to do something like?

target = dev_get_drvdata(&dev->dev);
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux