[LTP] [PATCH v6 1/2] tst_find_backing_dev: Get dev name from /sys/dev/block/*/uevent

Richard Palethorpe rpalethorpe@suse.de
Thu Nov 10 12:16:42 CET 2022


Hello,

Pushed with minor changes, thanks!

I added some whitespace and replaced my signoff tag with reviewed by.

Alessandro Carminati <alessandro.carminati@gmail.com> writes:

> +			if (errno == ENOTTY)
> +				tst_brkm(TBROK | TERRNO, NULL, "BTRFS ioctl failed. Is %s on a tmpfs?", path);
> +			tst_brkm(TBROK | TERRNO, NULL, "BTRFS ioctl
> failed with %d.", errno);

TERRNO prints the errno, instead I added the tmp_path.

>  
> -	SAFE_FCLOSE(NULL, file);
> +	if (!access(uevent_path, R_OK)) {
> +		FILE_LINES_SCANF(NULL, uevent_path, "DEVNAME=%s", dev_name);
>  
> -	if (!*dev)
> -		tst_brkm(TBROK, NULL, "Cannot find block device for %s", path);
> +		if (dev_name[0])
> +			sprintf(dev, "/dev/%s", dev_name);

GCC 12 complains about a null ptr deref here. Seems unlikely to happen,
but I added the nonnull attribute to silence the warning.

> +	} else {
> +		tst_brkm(TBROK, NULL, "uevent file (%s) access failed", uevent_path);
> +	}
>  
>  	if (stat(dev, &buf) < 0)
>  		tst_brkm(TWARN | TERRNO, NULL, "stat(%s) failed", dev);


-- 
Thank you,
Richard.


More information about the ltp mailing list