]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Merge branch 'libblkid/drbd/padding' of https://github.com/t-8ch/util-linux
authorKarel Zak <kzak@redhat.com>
Wed, 17 Jan 2024 08:43:05 +0000 (09:43 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 17 Jan 2024 08:43:05 +0000 (09:43 +0100)
* 'libblkid/drbd/padding' of https://github.com/t-8ch/util-linux:
  libblkid: (drbd) validate zero padding
  libblkid: avoid aligning out of probing area

1  2 
libblkid/src/superblocks/drbd.c

index 7f72eb13f3d0cb68eb674ff0a0fc4ffcd69dbeb0,b4259069278ddf912bcc11a8b162145b184ef7af..811098a5d2d23d409259eafb2c4eac7ebcfd9b60
@@@ -124,9 -122,19 +122,19 @@@ struct meta_data_on_disk_9 
  } __attribute__((packed));
  
  
+ static int is_zero_padded(const unsigned char *padding_start,
+                         const unsigned char *padding_end)
+ {
+       for (; padding_start < padding_end; padding_start++) {
+               if (*padding_start != 0)
+                       return 0;
+       }
+       return 1;
+ }
  static int probe_drbd_84(blkid_probe pr, const struct blkid_idmag *mag)
  {
 -      struct md_on_disk_08 *md;
 +      const struct md_on_disk_08 *md;
  
        md = blkid_probe_get_sb(pr, mag, struct md_on_disk_08);
        if (!md)