From 8a590bcb649f3c22cc253c3d7f97c1541de5b7b4 Mon Sep 17 00:00:00 2001 From: l30027544 Date: Wed, 17 Jul 2024 17:51:15 +0800 Subject: [PATCH] code check Signed-off-by: l30027544 --- 1006-add-hmfs-for-blkid.patch | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/1006-add-hmfs-for-blkid.patch b/1006-add-hmfs-for-blkid.patch index ad6c13a2..b49c2996 100644 --- a/1006-add-hmfs-for-blkid.patch +++ b/1006-add-hmfs-for-blkid.patch @@ -2,34 +2,36 @@ diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index b8b6558..1111c93 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c -@@ -1440,6 +1440,22 @@ static int probe_f2fs(struct blkid_probe *probe, +@@ -1440,6 +1440,24 @@ static int probe_f2fs(struct blkid_probe *probe, return 0; } +static int probe_hmfs(struct blkid_probe *probe, -+ struct blkid_magic *id __BLKID_ATTR((unused)), -+ unsigned char *buf) ++ struct blkid_magic *id __BLKID_ATTR((unused)), ++ unsigned char *buf) +{ -+ hmfs_super_block *bs; -+ ++ hmfs_super_block *bs = NULL; ++ if (buf == NULL) { ++ return -1; ++ } + bs = (hmfs_super_block *)buf; + set_uuid(probe->dev, bs->uuid, 0); -+ if (bs->volume_name[0] != 0) { -+ unsigned char vol_name_utf8[513] = {0}; -+ unicode_16le_to_utf8(vol_name_utf8, 512, (const unsigned char*)bs->volume_name, 512 * sizeof(__u16)); -+ blkid_set_tag(probe->dev, "LABEL", vol_name_utf8, 512); -+ } ++ if (bs->volume_name[0] != 0) { ++ unsigned char vol_name_utf8[513] = {0}; ++ unicode_16le_to_utf8(vol_name_utf8, 512, (const unsigned char*)bs->volume_name, 512 * sizeof(__u16)); ++ blkid_set_tag(probe->dev, "LABEL", vol_name_utf8, 512); ++ } + return 0; +} + static uint64_t exfat_block_to_offset(const struct exfat_super_block *sb, uint64_t block) { -@@ -1646,6 +1662,7 @@ static struct blkid_magic type_array[] = { +@@ -1646,6 +1664,7 @@ static struct blkid_magic type_array[] = { { "lvm2pv", 1, 0x218, 8, "LVM2 001", probe_lvm2 }, { "btrfs", 64, 0x40, 8, "_BHRfS_M", probe_btrfs }, { "f2fs", 1, 0, 4, "\x10\x20\xf5\xf2", probe_f2fs }, -+ { "hmfs", 1, 0, 4, "\x24\x20\xf5\xfe", probe_hmfs }, ++ { "hmfs", 1, 0, 4, "\x24\x20\xf5\xfe", probe_hmfs }, { "exfat", 0, 3, 8, "EXFAT ", probe_exfat }, { NULL, 0, 0, 0, NULL, NULL } }; -- Gitee