Commit r1072 removed the check for NULL pointer strings in the mac partition lookup. However, without that check we would end up dereferencing this string pointer later, breaking my Debian Lenny test image.
Add the check back in. This fixes Lenny with quik again.
Signed-off-by: Alexander Graf agraf@suse.de --- packages/mac-parts.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/packages/mac-parts.c b/packages/mac-parts.c index d0cba05..330d8a0 100644 --- a/packages/mac-parts.c +++ b/packages/mac-parts.c @@ -126,7 +126,7 @@ macparts_open( macparts_info_t *di ) * Implement partition selection as per the PowerPC Microprocessor CHRP bindings */
- if (parnum == 0) { + if (str == NULL || parnum == 0) { /* According to the spec, partition 0 as well as no arguments means the whole disk */ offs = (long long)0; size = (long long)__be32_to_cpu(dmap.sbBlkCount) * bs;
On 14/02/13 01:02, Alexander Graf wrote:
Commit r1072 removed the check for NULL pointer strings in the mac partition lookup. However, without that check we would end up dereferencing this string pointer later, breaking my Debian Lenny test image.
Add the check back in. This fixes Lenny with quik again.
Signed-off-by: Alexander Grafagraf@suse.de
packages/mac-parts.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/packages/mac-parts.c b/packages/mac-parts.c index d0cba05..330d8a0 100644 --- a/packages/mac-parts.c +++ b/packages/mac-parts.c @@ -126,7 +126,7 @@ macparts_open( macparts_info_t *di ) * Implement partition selection as per the PowerPC Microprocessor CHRP bindings */
- if (parnum == 0) {
- if (str == NULL || parnum == 0) { /* According to the spec, partition 0 as well as no arguments means the whole disk */ offs = (long long)0; size = (long long)__be32_to_cpu(dmap.sbBlkCount) * bs;
Strangely this works for me if I build with -O0 -g but not with the default of -Os -g. Investigating...
ATB,
Mark.
On 23/02/13 16:54, Mark Cave-Ayland wrote:
Strangely this works for me if I build with -O0 -g but not with the default of -Os -g. Investigating...
Seems there was another missing NULL check which when added back in fixes the quik issue for me, and still continues to boot all of my test images. Alex, can you check the revised version at your end and ack?
Many thanks,
Mark.
On 2013-Feb-23 11:54 , Mark Cave-Ayland wrote:
- if (str == NULL || parnum == 0) { /* According to the spec, partition 0 as well as no
arguments means the whole disk */ offs = (long long)0; size = (long long)__be32_to_cpu(dmap.sbBlkCount) * bs;
Strangely this works for me if I build with -O0 -g but not with the default of -Os -g. Investigating...
Aren't there parens missing? I.e., shouldn't that be ((str == NULL) || (parnum == 0))?
On 23/02/13 21:43, Tarl Neustaedter wrote:
Aren't there parens missing? I.e., shouldn't that be ((str == NULL) || (parnum == 0))?
Not as far as I know unless there is a compiler issue? The C operator precedence table looks like this: http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm.
ATB,
Mark.
On 2013-Feb-23 17:42 , Mark Cave-Ayland wrote:
Aren't there parens missing? I.e., shouldn't that be ((str == NULL) || (parnum == 0))?
Not as far as I know unless there is a compiler issue? The C operator precedence table looks like this: http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm.
You can see my inherent trust in compiler writers showing...
If you're still having a problem with optimization doing something strange, I'd try the parens. Either that or look at whether the test really should be str == NULL (is there an uninitialized path in there?). Regards, Tarl