Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

efivar-0.21 fails to create boot entry when device min number > 127 #33

Closed
ssten opened this issue Aug 24, 2015 · 0 comments
Closed

efivar-0.21 fails to create boot entry when device min number > 127 #33

ssten opened this issue Aug 24, 2015 · 0 comments

Comments

@ssten
Copy link

ssten commented Aug 24, 2015

No need to reproduce I guess, just see into linux.c:62:

set_disk_and_part_name(struct disk_info *info)

rc = sysfs_readlink(&linkbuf, "/sys/dev/block/%"PRIu64":%hhd",
info->major, info->minor);

%hhd prints unsigned info->minor as signed, which causes wrong device path if info->minor is greater than 127:

lsblk | grep sdj

sdj 8:144 1 29.8G 0 disk
├─sdj1 8:145 1 1G 0 part /boot
└─sdj2 8:146 1 28.8G 0 part /

strace efibootmgr -c -d /dev/sdj -p 1 -L … -l … -u … :
open("/dev/sdj", O_RDONLY) = 3
fstat(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 144), ...}) = 0
readlink("/sys/dev/block/8:-112", 0x7ffd5a0f9080, 4096) = -1 ENOENT

simple patch:

--- src/linux.c.old 2015-08-24 16:34:13.606782416 +0600
+++ src/linux.c 2015-08-24 16:34:21.366845626 +0600
@@ -59,7 +59,7 @@
char *linkbuf;
ssize_t rc;

- rc = sysfs_readlink(&linkbuf, "/sys/dev/block/%"PRIu64":%hhd",

  •   rc = sysfs_readlink(&linkbuf, "/sys/dev/block/%"PRIu64":%hhu",
                    info->major, info->minor);
      if (rc < 0)
              return -1;
    
@ssten ssten changed the title efibootmgr-0.21 fails to create boot entry when device min number > 127 efivar-0.21 fails to create boot entry when device min number > 127 Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant