merge mainline into hints

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-12-24 02:52:43 +01:00
commit 2b5c1a0810
6 changed files with 53 additions and 18 deletions

View file

@ -607,12 +607,13 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
while (l)
{
(disk->read_hook) (s, o,
((l > GRUB_DISK_SECTOR_SIZE)
? GRUB_DISK_SECTOR_SIZE
: l));
grub_size_t cl;
cl = GRUB_DISK_SECTOR_SIZE - o;
if (cl > l)
cl = l;
(disk->read_hook) (s, o, cl);
s++;
l -= GRUB_DISK_SECTOR_SIZE - o;
l -= cl;
o = 0;
}
}

View file

@ -164,7 +164,7 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
strings, so we will add a NULL byte at the end explicitly. */
pathlen += 1;
devpath = grub_malloc (pathlen);
devpath = grub_malloc (pathlen + 1);
if (! devpath)
{
grub_free (devtype);
@ -173,12 +173,15 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias))
}
if (grub_ieee1275_get_property (aliases, aliasname, devpath, pathlen,
&actual))
&actual) || actual < 0)
{
grub_dprintf ("devalias", "get_property (%s) failed\n", aliasname);
goto nextprop;
}
devpath [actual] = '\0';
if (actual > pathlen)
actual = pathlen;
devpath[actual] = '\0';
devpath[pathlen] = '\0';
if (grub_ieee1275_finddevice (devpath, &dev))
{
@ -294,7 +297,8 @@ grub_ieee1275_get_devname (const char *path)
int match_alias (struct grub_ieee1275_devalias *curalias)
{
/* briQ firmware can change capitalization in /chosen/bootpath. */
if (! grub_strncasecmp (curalias->path, path, pathlen))
if (grub_strncasecmp (curalias->path, path, pathlen) == 0
&& curalias->path[pathlen] == 0)
{
newpath = grub_strdup (curalias->name);
return 1;
@ -446,7 +450,7 @@ grub_ieee1275_encode_devname (const char *path)
/* GRUB partition 1 is OF partition 0. */
partno++;
encoding = grub_xasprintf ("%s,%d", device, partno);
encoding = grub_xasprintf ("ieee1275/%s,%d", device, partno);
}
else
encoding = grub_strdup (device);