Re: [PATCH v2 1/2] livepatch: Initialize shadow variables safely by a custom callback

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

 



On Thu, Apr 05, 2018 at 02:23:14PM +0200, Petr Mladek wrote:
> @@ -150,6 +149,23 @@ static void *__klp_shadow_get_or_alloc(void *obj, unsigned long id, void *data,
>  		goto exists;
>  	}
>  
> +	new_shadow->obj = obj;
> +	new_shadow->id = id;
> +
> +	if (ctor) {
> +		int err;
> +
> +		err = ctor(obj, new_shadow->data, ctor_data);
> +		if (err) {
> +			spin_unlock_irqrestore(&klp_shadow_lock, flags);
> +			kfree(new_shadow);
> +			WARN(1,
> +			     "Failed to construct shadow variable <%p, %lx>\n",
> +			     obj, id);
> +			return NULL;
> +		}
> +	}
> +

I'm not sure why a constructor would return an error, though I guess it
doesn't hurt to allow it.

The WARN seems excessive though, IMO.  The constructor itself can warn
(or printk or whatever else) if it thinks its warranted.

Also I think the 'err' variable isn't really needed.

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe live-patching" 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]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux