ata-disk.c:ad_init(): max_iosize might be uninitialized?

Alexander Motin mav at FreeBSD.org
Mon Jul 12 20:37:17 UTC 2010


Mikolaj Golub wrote:
> On Mon, 12 Jul 2010 23:05:53 +0300 Alexander Motin wrote:
> 
>  AM> Hi.
> 
>  AM> Mikolaj Golub wrote:
>  >> It might be a wrong list but I have not found freebsd-ata@ or freebsd-disk@
>  >> list -).
>  >> 
>  >> I just have looked accidentally at ad_init() in dev/ata/ata-disk.c and it
>  >> looks like there is at least theoretical possibility that atadev->max_iosize
>  >> remains uninitialized (if ata_controlcmd(ATA_SET_MULTI) fails). Shouldn't be
>  >> like in the patch below?
> 
>  AM> It is not very obvious, but it is initialized in ata_add_child().
> 
> Ah, I see. Thank you :-). But then "else atadev->max_iosize = DEV_BSIZE;" part
> in ad_init() looks like unnecessary and rather confusing (it suggests that
> max_iosize is initialized by this funtion.

Probably so. And thinking a bit more I've got to idea that you were not
completely wrong initially. If device was reset after initial probe and
then reinitialization failed, atadev->max_iosize probably should be
reduced to stay on safe side.

-- 
Alexander Motin


More information about the freebsd-fs mailing list