OSDN Git Service

android-x86/external-efibootmgr.git
9 years agoMake -o's behavior actually match the documented behavior.
Peter Jones [Mon, 20 Oct 2014 16:04:34 +0000 (12:04 -0400)]
Make -o's behavior actually match the documented behavior.

Also make it a bit better and reporting errors.

This should actually resolve
https://github.com/vathpela/efibootmgr/issues/12 .

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't error on unset BootOrder when we're trying to add to or rm from it.
Peter Jones [Wed, 15 Oct 2014 14:28:13 +0000 (10:28 -0400)]
Don't error on unset BootOrder when we're trying to add to or rm from it.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoProduce a slightly more succinct error when we get -EPERM on the disk.
Peter Jones [Wed, 15 Oct 2014 14:16:55 +0000 (10:16 -0400)]
Produce a slightly more succinct error when we get -EPERM on the disk.

Because one error message is enough.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't call EPERM "not found" when deleting variables.
Peter Jones [Wed, 15 Oct 2014 14:09:13 +0000 (10:09 -0400)]
Don't call EPERM "not found" when deleting variables.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agomanpage lists option '--test' which doesn't seem to exist
D. Jared Dominguez [Tue, 14 Oct 2014 21:24:02 +0000 (16:24 -0500)]
manpage lists option '--test' which doesn't seem to exist

I'm passing along this bug report from Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=759714

Here's a quick fix:

9 years agoAdd more error messages and better return codes.
Peter Jones [Wed, 15 Oct 2014 13:20:04 +0000 (09:20 -0400)]
Add more error messages and better return codes.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoOne more place we're not printing the error code.
Peter Jones [Tue, 14 Oct 2014 21:15:43 +0000 (17:15 -0400)]
One more place we're not printing the error code.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoFix a segfault in append_extra_args_ascii()
Peter Jones [Tue, 14 Oct 2014 21:09:37 +0000 (17:09 -0400)]
Fix a segfault in append_extra_args_ascii()

How that worked at all before was beyond me.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoMake a few more return paths print some modicum of error message.
Peter Jones [Tue, 14 Oct 2014 19:09:56 +0000 (15:09 -0400)]
Make a few more return paths print some modicum of error message.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't define our own ioctls unless we have to.
Peter Jones [Fri, 10 Oct 2014 21:09:51 +0000 (17:09 -0400)]
Don't define our own ioctls unless we have to.

The way it was, BLKGETSIZE64 wound up being 0x80041272 instead of the
0x80081272 it should be on -m32 builds.  4 isn't the size of 64 bits, so
that results in integer overflow into who knows what space on the stack,
and when we compare it to our gpt header, it's also just plain wrong.

This is all madness, of course, the kernel has exported all of this
stuff since the ancient past.  Use that instead.

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Michael Tokarev <mjt@tls.msk.ru>
9 years agoLinux kernel versions aren't always 3-tuples any more.
Peter Jones [Fri, 10 Oct 2014 20:42:08 +0000 (16:42 -0400)]
Linux kernel versions aren't always 3-tuples any more.

So we need to handle "3.10" as a version number correctly.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoClarify -o parameters.
Peter Jones [Wed, 8 Oct 2014 18:08:27 +0000 (14:08 -0400)]
Clarify -o parameters.

Clarify the values that can be given to -o, as it has led to some minor
confusion.

Resolves: https://github.com/vathpela/efibootmgr/issues/12

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoRelease 0.9.0
Peter Jones [Thu, 25 Sep 2014 18:00:18 +0000 (14:00 -0400)]
Release 0.9.0

I really should get rid of the third section of the version numbers.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't pass uninitialized data to efi_guid_to_str().
Peter Jones [Thu, 25 Sep 2014 16:46:43 +0000 (12:46 -0400)]
Don't pass uninitialized data to efi_guid_to_str().

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't leak our partition table structures.
Peter Jones [Wed, 10 Sep 2014 21:03:23 +0000 (17:03 -0400)]
Don't leak our partition table structures.

Covscan once more.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoCheck lseek() for errors.
Peter Jones [Wed, 10 Sep 2014 20:56:49 +0000 (16:56 -0400)]
Check lseek() for errors.

Covscan.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoCheck open()s return correctly.
Peter Jones [Wed, 10 Sep 2014 20:50:08 +0000 (16:50 -0400)]
Check open()s return correctly.

Covscan.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoCheck malloc() return.
Peter Jones [Wed, 10 Sep 2014 20:49:51 +0000 (16:49 -0400)]
Check malloc() return.

Covscan.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoMake a free non-conditional since the condition can't be ture.
Peter Jones [Wed, 10 Sep 2014 20:24:03 +0000 (16:24 -0400)]
Make a free non-conditional since the condition can't be ture.

Covscan again.  I wonder if it'll complain about this.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoHandle the case where there are no EFI variables.
Peter Jones [Wed, 10 Sep 2014 20:22:21 +0000 (16:22 -0400)]
Handle the case where there are no EFI variables.

So we're on an EFI machine with no variables, eh covscan?

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't reuse a pointer to static data and free conditionally.
Peter Jones [Wed, 10 Sep 2014 20:20:04 +0000 (16:20 -0400)]
Don't reuse a pointer to static data and free conditionally.

Instead, use a second pointer and free that, because poor covscan can't
figure out what's going on.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't free something that shouldn't ever be non-NULL.
Peter Jones [Wed, 10 Sep 2014 20:15:27 +0000 (16:15 -0400)]
Don't free something that shouldn't ever be non-NULL.

Instead, check and error if it's non-NULL.

(Covscan, which got this completely wrong.)

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoCovscan can't tell that we're not filling a buffer...
Peter Jones [Wed, 10 Sep 2014 20:07:02 +0000 (16:07 -0400)]
Covscan can't tell that we're not filling a buffer...

Because the pattern here is:

rc = func_call(buf, buflen)
if (rc < 0)
return error;
buflen = rc;
buf = calloc(1, buflen)
if (!buf)
return error;
rc = func_call(buf, buflen);

Covscan thinks the first func_call() might actually be doing something
to buf.  It isn't, but that's not obvious.  So make it NULL and 0
instead of buf and buflen on the first call.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoGet rid of an invalid comparison.
Peter Jones [Wed, 10 Sep 2014 20:02:58 +0000 (16:02 -0400)]
Get rid of an invalid comparison.

Covscan.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoTry to avoid covscan freaking out about sscanf with %n.
Peter Jones [Wed, 10 Sep 2014 19:57:26 +0000 (15:57 -0400)]
Try to avoid covscan freaking out about sscanf with %n.

covscan says:

 5. efibootmgr-0.8.0/src/lib/disk.c:96:tainted_data_argument – Calling
 function "fgets(char * restrict, int, FILE * restrict)" taints argument
 "line".
 10. efibootmgr-0.8.0/src/lib/disk.c:103:vararg_transitive – Call to
 "sscanf(char const * restrict, char const * restrict, ...)" with
 tainted argument "line" taints "major".
 11. efibootmgr-0.8.0/src/lib/disk.c:103:vararg_transitive – Call to
 "sscanf(char const * restrict, char const * restrict, ...)" with
 tainted argument "line" taints "scanned".
 13. efibootmgr-0.8.0/src/lib/disk.c:103:tainted_data – Using tainted
 variable "scanned" as an index into an array "line".

I *think* that's really complaining that if sscanf fails before
processing %n, then "scanned" is indeterminate here.  So I've assigned
it to 0.

Either way, if any of that goes wrong, the code's going to completely
fail.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoFix an error path not checking the return right in make_linux_load_option
Peter Jones [Wed, 10 Sep 2014 19:47:57 +0000 (15:47 -0400)]
Fix an error path not checking the return right in make_linux_load_option

Covscan once again.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoMake sure data created for load options is freed.
Peter Jones [Wed, 10 Sep 2014 19:46:04 +0000 (15:46 -0400)]
Make sure data created for load options is freed.

Covscan... may not be right about this one.  But it's better to be sure.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoFix some minor memory leaks.
Peter Jones [Wed, 10 Sep 2014 19:40:29 +0000 (15:40 -0400)]
Fix some minor memory leaks.

Well, one and not really another.  Covscan is /almost/ a great tool.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoFix another leaked fd.
Peter Jones [Wed, 10 Sep 2014 19:34:12 +0000 (15:34 -0400)]
Fix another leaked fd.

Covscan some more.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't leak our socket's fd when determining network info.
Peter Jones [Wed, 10 Sep 2014 19:32:59 +0000 (15:32 -0400)]
Don't leak our socket's fd when determining network info.

Covscan again.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoMake the return path something coverity can actually understand.
Peter Jones [Wed, 10 Sep 2014 19:29:43 +0000 (15:29 -0400)]
Make the return path something coverity can actually understand.

It was *correct* before, but there's no reason to do it that weird way.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoFix a bad allocation size.
Peter Jones [Wed, 10 Sep 2014 19:27:02 +0000 (15:27 -0400)]
Fix a bad allocation size.

Covscan found this.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoRelease 0.8.0
Peter Jones [Tue, 9 Sep 2014 15:18:09 +0000 (11:18 -0400)]
Release 0.8.0

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years ago[man] Make option names match what efibootmgr actually provides.
Peter Jones [Tue, 2 Sep 2014 13:41:08 +0000 (09:41 -0400)]
[man] Make option names match what efibootmgr actually provides.

Related: rhbz#948844

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoFix some minor errors cppcheck found.
Peter Jones [Fri, 1 Aug 2014 12:57:17 +0000 (08:57 -0400)]
Fix some minor errors cppcheck found.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoMove TODO stuff to 0.9
Peter Jones [Fri, 1 Aug 2014 12:44:46 +0000 (08:44 -0400)]
Move TODO stuff to 0.9

Wound up doing some work that's more important than the stuff in the
TODO, so it's all getting moved out to 0.9

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoClean up some whitespace.
Peter Jones [Fri, 1 Aug 2014 12:36:49 +0000 (08:36 -0400)]
Clean up some whitespace.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoAdd the ability to clean up duplicates in BootOrder
Peter Jones [Fri, 1 Aug 2014 12:23:34 +0000 (08:23 -0400)]
Add the ability to clean up duplicates in BootOrder

This adds -D (--remove-dups), which iterates BootOrder and keeps only
the first of any number it finds.  Duplicate entries can happen as a
result of an interaction between fallback.efi and some system firmware,
and this option provides an easy workaround to fix it.

Resolves: rhbz#1097396

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoFix some leaked memory that shows up in valgrind.
Peter Jones [Fri, 1 Aug 2014 12:03:49 +0000 (08:03 -0400)]
Fix some leaked memory that shows up in valgrind.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't leak memory in remove_from_boot_order()
Peter Jones [Fri, 1 Aug 2014 09:37:05 +0000 (05:37 -0400)]
Don't leak memory in remove_from_boot_order()

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoDon't pass around a format specifier when we don't need to.
Peter Jones [Fri, 1 Aug 2014 08:56:18 +0000 (04:56 -0400)]
Don't pass around a format specifier when we don't need to.

Current code has the format specifier in a function that doesn't
otherwise know about the format, and passes it in to a function that
does.

And it's always been like this.

Signed-off-by: Peter Jones <pjones@redhat.com>
9 years agoCompare should respect the size of the data it compares.
groxxda [Thu, 31 Jul 2014 16:37:37 +0000 (18:37 +0200)]
Compare should respect the size of the data it compares.

10 years agoUse PRIx64 in nvme parsing.
Peter Jones [Tue, 22 Jul 2014 14:11:39 +0000 (10:11 -0400)]
Use PRIx64 in nvme parsing.

This should fix https://github.com/vathpela/efibootmgr/issues/6 , though
I don't know if it'll actually make nvme work.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoClang uses C99 semantics by default for inline keyword.
Daniel Jared Dominguez [Tue, 8 Jul 2014 01:50:50 +0000 (20:50 -0500)]
Clang uses C99 semantics by default for inline keyword.

It's most straightforward not to state get_scsi_idlun is inline.

Signed-off-by: Daniel Jared Dominguez <Jared_Dominguez@Dell.com>
10 years agoVariable "needed" should be of type ssize_t as that's how it's used.
Daniel Jared Dominguez [Mon, 7 Jul 2014 19:18:27 +0000 (14:18 -0500)]
Variable "needed" should be of type ssize_t as that's how it's used.

Signed-off-by: Daniel Jared Dominguez <Jared_Dominguez@Dell.com>
10 years agodata_size in construct_boot_order/set_boot_order is of type size_t, so fix a couple...
Daniel Jared Dominguez [Mon, 7 Jul 2014 19:09:15 +0000 (14:09 -0500)]
data_size in construct_boot_order/set_boot_order is of type size_t, so fix a couple of comparisons involving it.

Signed-off-by: Daniel Jared Dominguez <Jared_Dominguez@Dell.com>
10 years agoFix typo in compare function.
Daniel Jared Dominguez [Mon, 7 Jul 2014 19:02:22 +0000 (14:02 -0500)]
Fix typo in compare function.

Signed-off-by: Daniel Jared Dominguez <Jared_Dominguez@Dell.com>
10 years agoRemove unused function var_num_from_name.
Daniel Jared Dominguez [Mon, 7 Jul 2014 18:58:56 +0000 (13:58 -0500)]
Remove unused function var_num_from_name.

Signed-off-by: Daniel Jared Dominguez <Jared_Dominguez@Dell.com>
10 years agoMitigate apple setting invalid attribute bits in boot variables.
Peter Jones [Tue, 17 Jun 2014 18:05:31 +0000 (14:05 -0400)]
Mitigate apple setting invalid attribute bits in boot variables.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoWe don't actually have docbook hooked up to the builds, so ditch it.
Peter Jones [Mon, 16 Jun 2014 18:26:05 +0000 (14:26 -0400)]
We don't actually have docbook hooked up to the builds, so ditch it.

Frankly I'm more comfortable maintaining groff anyway, but right now
they just get out of sync all the time.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoOnly free hard drive signatures if we've allocated them.
Peter Jones [Mon, 5 May 2014 20:09:09 +0000 (16:09 -0400)]
Only free hard drive signatures if we've allocated them.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoRemove bogus test for optional data length bounds.
Peter Jones [Tue, 29 Apr 2014 15:31:15 +0000 (11:31 -0400)]
Remove bogus test for optional data length bounds.

We're getting the size from subtracting from the actual limit; it can't
be over the limit, and it's not related to the variable we're comparing
it to anyway.

Not sure how I came up with that logic, but it sure is wrong.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake nvme work with "-e 3".
Peter Jones [Mon, 14 Apr 2014 21:19:57 +0000 (17:19 -0400)]
Make nvme work with "-e 3".

This will force a long-form NVME device path.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd support for displaying NVME device paths.
Peter Jones [Mon, 14 Apr 2014 20:49:12 +0000 (16:49 -0400)]
Add support for displaying NVME device paths.

This doesn't actually let you /use/ them yet, but it does show them if
they're there.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoGet a lot more picky with our compiler warnings.
Peter Jones [Mon, 14 Apr 2014 20:39:42 +0000 (16:39 -0400)]
Get a lot more picky with our compiler warnings.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFilenames and github - the worst of both worlds.
Peter Jones [Wed, 2 Apr 2014 14:04:52 +0000 (10:04 -0400)]
Filenames and github - the worst of both worlds.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoCall it 0.7
Peter Jones [Tue, 1 Apr 2014 18:53:43 +0000 (14:53 -0400)]
Call it 0.7

This has been around for a while, and it's not going to get any more
testing without some exposure.  Let's give it a shot.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix device path size and allocation in make_file_path_device_path()
Peter Jones [Thu, 13 Mar 2014 01:31:45 +0000 (21:31 -0400)]
Fix device path size and allocation in make_file_path_device_path()

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix a missing error return.
Peter Jones [Thu, 6 Mar 2014 20:05:58 +0000 (15:05 -0500)]
Fix a missing error return.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd a --keep option to preserve the old BootOrder entries when using -o.
Peter Jones [Fri, 7 Feb 2014 18:33:17 +0000 (13:33 -0500)]
Add a --keep option to preserve the old BootOrder entries when using -o.

So basically if you've got a boot order of:

0000,0001,0018,001A,0019

And you do "efibootmgr -o 001A --keep", you'll get:

001A,0000,0001,0018,0019

And if you subsequently do "efibootmgr -o 0002 --keep" you'll get:

0002,001A,0000,0001,0018,0019

This is to work around a buggy firmware reported in rhbz#889509 ,
which will erroneously try to re-populate BootOrder /and create new
Boot#### entries to do so/ if you supply a BootOrder without the
defaults in it.

This firmware is garbage.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd SATA(x,y,z) device path unparsing.
Peter Jones [Thu, 6 Feb 2014 15:08:24 +0000 (10:08 -0500)]
Add SATA(x,y,z) device path unparsing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoGet the correct size for device path in our optional data blob.
Peter Jones [Wed, 5 Feb 2014 19:26:00 +0000 (14:26 -0500)]
Get the correct size for device path in our optional data blob.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd some requires to our spec file for efivar-libs and efivar-devel.
Peter Jones [Wed, 5 Feb 2014 18:46:53 +0000 (13:46 -0500)]
Add some requires to our spec file for efivar-libs and efivar-devel.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake Vendor-Defined Message paths show up the same way as in "bcfg boot dump".
Peter Jones [Wed, 5 Feb 2014 18:46:10 +0000 (13:46 -0500)]
Make Vendor-Defined Message paths show up the same way as in "bcfg boot dump".

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake FvFile show up the same way it does in "bcfg boot dump".
Peter Jones [Wed, 5 Feb 2014 18:45:39 +0000 (13:45 -0500)]
Make FvFile show up the same way it does in "bcfg boot dump".

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoHandle bogus malformed variables somewhat more gracefully.
Peter Jones [Wed, 5 Feb 2014 05:38:20 +0000 (00:38 -0500)]
Handle bogus malformed variables somewhat more gracefully.

Because previously we tried to dump what it was saying, but that really
just means crashing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix gpg path in "make archive".
Peter Jones [Wed, 5 Feb 2014 05:09:17 +0000 (00:09 -0500)]
Fix gpg path in "make archive".

Still pointed at .tar.gz while everything else says .tar.bz2

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake the man page not mention proc, and make it mention efivarfs.
Peter Jones [Wed, 5 Feb 2014 04:53:22 +0000 (23:53 -0500)]
Make the man page not mention proc, and make it mention efivarfs.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMerge the old TODO and the new one.
Peter Jones [Wed, 5 Feb 2014 04:50:19 +0000 (23:50 -0500)]
Merge the old TODO and the new one.

Oops.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoUpdate urls in README.
Peter Jones [Wed, 5 Feb 2014 04:47:26 +0000 (23:47 -0500)]
Update urls in README.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoUpdate TODO.
Peter Jones [Wed, 5 Feb 2014 04:40:01 +0000 (23:40 -0500)]
Update TODO.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoGet rid of the 1024-byte limit on ESP file path.
Peter Jones [Wed, 5 Feb 2014 04:26:47 +0000 (23:26 -0500)]
Get rid of the 1024-byte limit on ESP file path.

Not that I think 1024 was something we were going to hit there, but...

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoHandle some other device paths.
Peter Jones [Wed, 5 Feb 2014 04:02:25 +0000 (23:02 -0500)]
Handle some other device paths.

Add support for Vendor-Defined Messaging Device Paths as well as
FVFILE() and FVVOL()

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoGet rid of 1024-byte limit for displaying variables as well.
Peter Jones [Wed, 5 Feb 2014 03:39:00 +0000 (22:39 -0500)]
Get rid of 1024-byte limit for displaying variables as well.

This basically makes all of unparse_path() and its derivatives into
snprintf()-like functions, so we don't have to have static buffers.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAdd a TODO here so I can keep track of what is yet to be done.
Peter Jones [Tue, 4 Feb 2014 23:51:45 +0000 (18:51 -0500)]
Add a TODO here so I can keep track of what is yet to be done.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoTypo fix.
Peter Jones [Tue, 10 Sep 2013 18:46:00 +0000 (14:46 -0400)]
Typo fix.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoCorrectly fill out sa_family for MAC address device types.
Peter Jones [Tue, 10 Sep 2013 15:25:41 +0000 (11:25 -0400)]
Correctly fill out sa_family for MAC address device types.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoHandle virtio network devices.
Peter Jones [Fri, 6 Sep 2013 18:49:28 +0000 (14:49 -0400)]
Handle virtio network devices.

Just like virtio scsi devices, look up their bus/device/function by the
virtio device instead of the traditional way.

Signed-off-by: Peter Jones <pjones@redhat.com>
Tested-and-reviewed-by: Laszlo Ersek <lersek@redhat.com>
10 years ago'-h' is a valid option, recognize it
Laszlo Ersek [Mon, 9 Sep 2013 09:37:39 +0000 (11:37 +0200)]
'-h' is a valid option, recognize it

This completes commit e562a948.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
10 years agoIgnore patches.
Peter Jones [Fri, 6 Sep 2013 20:18:12 +0000 (16:18 -0400)]
Ignore patches.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoRemove 40-character limit on file paths in /boot.
Peter Jones [Fri, 6 Sep 2013 20:17:20 +0000 (16:17 -0400)]
Remove 40-character limit on file paths in /boot.

This is totally unnecessary now; the only real point before was
everything was fixed size to keep it within 1024.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoDon't allow negative boot numbers.
Peter Jones [Fri, 6 Sep 2013 18:46:18 +0000 (14:46 -0400)]
Don't allow negative boot numbers.

In the case where you typo the command line and do:

efibootmgr -b -a blah blah blah

instead of

efibootmgr -b 0001 -a blah blah blah

sscanf(..., "%X", &num) happily produces a successful return code and a
value of -10.  This later results in us creating a boot variable named
BootFFFFFFFF6 , which is clearly not okay.  So if we've got a negative
number there, it's probably not what the user wanted.

Bounds check the whole thing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake make_linux_load_option() slightly more readable.
Peter Jones [Fri, 6 Sep 2013 18:16:24 +0000 (14:16 -0400)]
Make make_linux_load_option() slightly more readable.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake add_extra_args_file() work properly.
Peter Jones [Fri, 6 Sep 2013 15:31:03 +0000 (11:31 -0400)]
Make add_extra_args_file() work properly.

Two things:
1) make it actually return the data
2) _ascii() and _unicode() will get invoked in some cases, and they need
   to handle the case where they do nothing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoAudit strlen() in append_extra_args_ascii() as well.
Peter Jones [Fri, 6 Sep 2013 15:23:16 +0000 (11:23 -0400)]
Audit strlen() in append_extra_args_ascii() as well.

Similar code, similar bugs.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoRestore old boot order behavior.
Peter Jones [Fri, 6 Sep 2013 15:13:39 +0000 (11:13 -0400)]
Restore old boot order behavior.

Previously we prepended rather than appending new elements to the boot
order.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoDo better error checking in read_boot_u16(), and simplify it.
Peter Jones [Fri, 6 Sep 2013 15:02:13 +0000 (11:02 -0400)]
Do better error checking in read_boot_u16(), and simplify it.

Why am I even doing this stupid bitshifting?

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix byte assignment in read_boot_u16().
Peter Jones [Fri, 6 Sep 2013 14:57:50 +0000 (10:57 -0400)]
Fix byte assignment in read_boot_u16().

It helps if you put the bytes in the right order, and the parenthesis
around the right things to keep them from being all zero.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMore work on append_extra_args_unicode()
Peter Jones [Fri, 6 Sep 2013 14:43:35 +0000 (10:43 -0400)]
More work on append_extra_args_unicode()

two problems:
1) strlen off-by-one
2) efichar_from_char() awesomely takes a length in bytes, returns in
   bytes, and operates on efi_char16_t sizes.  This can be somewhat
   confusing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoYou really can't free something you put through realloc().
Peter Jones [Fri, 6 Sep 2013 14:24:22 +0000 (10:24 -0400)]
You really can't free something you put through realloc().

This should make '-u' work again.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix typo in arg parsing.
Peter Jones [Fri, 6 Sep 2013 14:10:18 +0000 (10:10 -0400)]
Fix typo in arg parsing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoRemove some dead code.
Peter Jones [Fri, 6 Sep 2013 14:00:40 +0000 (10:00 -0400)]
Remove some dead code.

If anybody's looking for it, it's in git.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoClean up .gitignores some.
Peter Jones [Fri, 6 Sep 2013 13:01:14 +0000 (09:01 -0400)]
Clean up .gitignores some.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake --help also -h, and don't have it exit with an error status.
Peter Jones [Thu, 5 Sep 2013 19:53:06 +0000 (15:53 -0400)]
Make --help also -h, and don't have it exit with an error status.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake tilt_slashes() static.
Peter Jones [Thu, 5 Sep 2013 19:52:50 +0000 (15:52 -0400)]
Make tilt_slashes() static.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix uninitialized variable.
Peter Jones [Thu, 5 Sep 2013 18:29:35 +0000 (14:29 -0400)]
Fix uninitialized variable.

valgrind found a couple of errors, one of which fixes some odd behavior
with BootOrder I was seeing.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix minor compiler warning.
Peter Jones [Thu, 5 Sep 2013 18:16:42 +0000 (14:16 -0400)]
Fix minor compiler warning.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoFix completely wrong compiler warning.
Peter Jones [Thu, 5 Sep 2013 18:15:53 +0000 (14:15 -0400)]
Fix completely wrong compiler warning.

gcc's data flow analysis still kind of blows.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoMake the error case from make_boot_var() cleaner.
Peter Jones [Thu, 5 Sep 2013 17:46:43 +0000 (13:46 -0400)]
Make the error case from make_boot_var() cleaner.

bcl thinks it looks better at the end, and I agree.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoDon't do unnecessary math.
Peter Jones [Thu, 5 Sep 2013 17:41:31 +0000 (13:41 -0400)]
Don't do unnecessary math.

bcl found this one too - we know len % 5 is 4, because it's tested a few
lines up.

Signed-off-by: Peter Jones <pjones@redhat.com>