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

Here is the environment cinfiguration: cpu - atom, sd card as bootabl… #704

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

bayrepo
Copy link
Contributor

@bayrepo bayrepo commented Oct 13, 2023

…e disk, loist of devices:

/sys/block/zram0
/sys/block/mmcblk0boot0
/sys/block/mmcblk0boot1
/sys/block/mmcblk2
/sys/block/mmcblk0

Hardinfo got nex pathes for reading for the report:

  1. cat /sys/block/mmcblk0/device/oemid

0x0103
2) # cat /sys/block/mmcblk2/device/oemid
0x534d
3) # cat /sys/block/mmcblk0boot0/device/oemid
cat: /sys/block/mmcblk0boot0/device/oemid: No such file or directory 4) # cat /sys/block/mmcblk0boot1/device/oemid
cat: /sys/block/mmcblk0boot1/device/oemid: No such file or directory

In the code no checks if files from previous step for device was read and pointer not NULL:

gchar *oemid_path = g_strdup_printf("/sys/block/%s/device/oemid", e->d->block_dev); gchar *manfid_path = g_strdup_printf("/sys/block/%s/device/manfid", e->d->block_dev); gchar *oemid = NULL, *manfid = NULL;
g_file_get_contents(oemid_path, &oemid, NULL, NULL); g_file_get_contents(manfid_path, &manfid, NULL, NULL);

unsigned int id = strtol(oemid, NULL, 16);
...
id = strtol(manfid, NULL, 16);

Before srttol need check for NULL

…e disk, loist of devices:

/sys/block/zram0
/sys/block/mmcblk0boot0
/sys/block/mmcblk0boot1
/sys/block/mmcblk2
/sys/block/mmcblk0

Hardinfo got nex pathes for reading for the report:

1) # cat /sys/block/mmcblk0/device/oemid
0x0103
2) # cat /sys/block/mmcblk2/device/oemid
0x534d
3) # cat /sys/block/mmcblk0boot0/device/oemid
cat: /sys/block/mmcblk0boot0/device/oemid: No such file or directory
4) # cat /sys/block/mmcblk0boot1/device/oemid
cat: /sys/block/mmcblk0boot1/device/oemid: No such file or directory

In the code no checks if files from previous step for device was read and pointer not NULL:

gchar *oemid_path = g_strdup_printf("/sys/block/%s/device/oemid", e->d->block_dev);
gchar *manfid_path = g_strdup_printf("/sys/block/%s/device/manfid", e->d->block_dev);
gchar *oemid = NULL, *manfid = NULL;
g_file_get_contents(oemid_path, &oemid, NULL, NULL);
g_file_get_contents(manfid_path, &manfid, NULL, NULL);

unsigned int id = strtol(oemid, NULL, 16);
...
id = strtol(manfid, NULL, 16);

Before srttol need check for NULL
@lpereira lpereira merged commit 01c8928 into lpereira:master Oct 13, 2023
3 checks passed
@lpereira
Copy link
Owner

Merged, thanks!

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

Successfully merging this pull request may close these issues.

2 participants