Re: [PATCH] misc/pvpanic: deduplicate comomn code

From: Greg Kroah-Hartman
Date: Wed Oct 11 2023 - 02:32:50 EST


On Wed, Oct 11, 2023 at 12:10:08AM +0200, Thomas Weißschuh wrote:
> +int devm_pvpanic_probe(struct device *dev, void __iomem *base)
> +{
> + struct pvpanic_instance *pi;
> + int ret;
> +
> + if (!base)
> + return -EINVAL;
> +
> + ret = devm_device_add_groups(dev, pvpanic_dev_groups);

You just raced with userspace and lost :(

Please just use the default groups attribute pointer, you should NEVER
need to manually add groups to a device like this.

And why are you calling this devm_*() for a probe function? That's
risky as you are now in the global namespace and this really is not a
devm_*() like function

thanks,

greg k-h