Skip to content

nvram: bogus partition listing #96

Open
@nathanlynch

Description

@nathanlynch

Since a6d31ca, nvram --partitions with large enough argument passed to --nvram-size prints a bogus all-zeros entry at the end:

[root@ltc-zz14-lp1 ~]# ~test/powerpc-utils/src/nvram --partitions
 # Sig Chk  Len  Name
 0  50  ef  0024 of-config
 1  70  99  009d common
 2  a0  b5  0083 ibm,rtas-log
 3  a0  4f  00fb lnx,oops-log
 4  7f  9b  0181 wwwwwwwwwwww
[root@ltc-zz14-lp1 ~]# ~test/powerpc-utils/src/nvram --partitions --nvram-size $((16 * 1024))
/home/test/powerpc-utils/src/nvram: WARNING: expected 16384 bytes, but only read 15360!
 # Sig Chk  Len  Name
 0  50  ef  0024 of-config
 1  70  99  009d common
 2  a0  b5  0083 ibm,rtas-log
 3  a0  4f  00fb lnx,oops-log
 4  7f  9b  0181 wwwwwwwwwwww
 5  00  00  0000                        <<<<<<<<<<

When the user forces there to be excess space in the nvram buffer, nvram_parse_partitions() constructs a bogus entry from the (fortunately zeroed) remainder.

I propose either:

  1. Ignoring --nvram-size with a warning, removing all supporting code. I don't know of a use for it, at least not on LPARs. Or:
  2. Clamping the nvram buffer allocation to the lesser of the user-supplied value and the size reported by the device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions