]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lsm: use lsm_blob_alloc() in lsm_bdev_alloc()
authorPaul Moore <paul@paul-moore.com>
Wed, 6 Aug 2025 21:17:07 +0000 (17:17 -0400)
committerPaul Moore <paul@paul-moore.com>
Mon, 11 Aug 2025 21:56:08 +0000 (17:56 -0400)
Convert the lsm_bdev_alloc() function to use the lsm_blob_alloc() helper
like all of the other LSM security blob allocators.

Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/security.c

index ad163f06bf7abc4327f9918f11b903e1649ef35e..a88ebfca32242026a82286dc1881d874a99d23fb 100644 (file)
@@ -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);
 }
 
 /**