[PATCH] lsm: use lsm_blob_alloc() in lsm_bdev_alloc()

Serge E. Hallyn serge at hallyn.com
Thu Aug 7 01:13:18 UTC 2025


On Wed, Aug 06, 2025 at 05:25:53PM -0400, Paul Moore wrote:
> Convert the lsm_bdev_alloc() function to use the lsm_blob_alloc() helper
> like all of the other LSM security blob allocators.
> 
> Signed-off-by: Paul Moore <paul at paul-moore.com>

Acked-by: Serge Hallyn <serge at hallyn.com>

> ---
>  security/security.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/security/security.c b/security/security.c
> index ad163f06bf7a..a88ebfca3224 100644
> --- a/security/security.c
> +++ b/security/security.c
> @@ -823,16 +823,8 @@ static int lsm_msg_msg_alloc(struct msg_msg *mp)
>   */
>  static int lsm_bdev_alloc(struct block_device *bdev)
>  {
> -	if (blob_sizes.lbs_bdev == 0) {
> -		bdev->bd_security = NULL;
> -		return 0;
> -	}
> -
> -	bdev->bd_security = kzalloc(blob_sizes.lbs_bdev, GFP_KERNEL);
> -	if (!bdev->bd_security)
> -		return -ENOMEM;
> -
> -	return 0;
> +	return lsm_blob_alloc(&bdev->bd_security, blob_sizes.lbs_bdev,
> +			      GFP_KERNEL);
>  }
>  
>  /**
> -- 
> 2.50.1
> 



More information about the Linux-security-module-archive mailing list