Message ID | 1367885035-23221-1-git-send-email-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 05/07/2013 08:03 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Coverity CID #997280, Nesting level does not match indentation > > Fix two bugs; the first is that the snprintf is redundant, the > second is that the following fwts_failed was should only be > printed on the if ((val < 0x1) || (val > 0xd)). Add explicit > { } brackets just to clarify the intent. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/dmi/dmi_decode/dmi_decode.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/dmi/dmi_decode/dmi_decode.c b/src/dmi/dmi_decode/dmi_decode.c > index 0e775db..d89ab28 100644 > --- a/src/dmi/dmi_decode/dmi_decode.c > +++ b/src/dmi/dmi_decode/dmi_decode.c > @@ -597,8 +597,7 @@ static void dmi_decode_entry(fwts_framework *fw, > "offset 0x%2.2x", > val, table, addr, i, 0x15 + (i*len)); > } else { > - if ((val < 0x1) || (val > 0xd)) > - snprintf(tmp, sizeof(tmp), "Base Board Type %d", i); > + if ((val < 0x1) || (val > 0xd)) { > fwts_failed(fw, LOG_LEVEL_HIGH, DMI_VALUE_OUT_OF_RANGE, > "Out of range value 0x%2.2" PRIx8 > " (range allowed 0x00..0x42) " > @@ -606,6 +605,7 @@ static void dmi_decode_entry(fwts_framework *fw, > "0x%8.8" PRIx32 ", field " > "'Base Board Type %d', offset 0x%2.2x", > val, table, addr, i, 0x15 + (i*len)); > + } > } > } > } > Acked-by: Alex Hung <alex.hung@canonical.com>
On 05/07/2013 08:03 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > Coverity CID #997280, Nesting level does not match indentation > > Fix two bugs; the first is that the snprintf is redundant, the > second is that the following fwts_failed was should only be > printed on the if ((val < 0x1) || (val > 0xd)). Add explicit > { } brackets just to clarify the intent. > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/dmi/dmi_decode/dmi_decode.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/dmi/dmi_decode/dmi_decode.c b/src/dmi/dmi_decode/dmi_decode.c > index 0e775db..d89ab28 100644 > --- a/src/dmi/dmi_decode/dmi_decode.c > +++ b/src/dmi/dmi_decode/dmi_decode.c > @@ -597,8 +597,7 @@ static void dmi_decode_entry(fwts_framework *fw, > "offset 0x%2.2x", > val, table, addr, i, 0x15 + (i*len)); > } else { > - if ((val < 0x1) || (val > 0xd)) > - snprintf(tmp, sizeof(tmp), "Base Board Type %d", i); > + if ((val < 0x1) || (val > 0xd)) { > fwts_failed(fw, LOG_LEVEL_HIGH, DMI_VALUE_OUT_OF_RANGE, > "Out of range value 0x%2.2" PRIx8 > " (range allowed 0x00..0x42) " > @@ -606,6 +605,7 @@ static void dmi_decode_entry(fwts_framework *fw, > "0x%8.8" PRIx32 ", field " > "'Base Board Type %d', offset 0x%2.2x", > val, table, addr, i, 0x15 + (i*len)); > + } > } > } > } > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/dmi/dmi_decode/dmi_decode.c b/src/dmi/dmi_decode/dmi_decode.c index 0e775db..d89ab28 100644 --- a/src/dmi/dmi_decode/dmi_decode.c +++ b/src/dmi/dmi_decode/dmi_decode.c @@ -597,8 +597,7 @@ static void dmi_decode_entry(fwts_framework *fw, "offset 0x%2.2x", val, table, addr, i, 0x15 + (i*len)); } else { - if ((val < 0x1) || (val > 0xd)) - snprintf(tmp, sizeof(tmp), "Base Board Type %d", i); + if ((val < 0x1) || (val > 0xd)) { fwts_failed(fw, LOG_LEVEL_HIGH, DMI_VALUE_OUT_OF_RANGE, "Out of range value 0x%2.2" PRIx8 " (range allowed 0x00..0x42) " @@ -606,6 +605,7 @@ static void dmi_decode_entry(fwts_framework *fw, "0x%8.8" PRIx32 ", field " "'Base Board Type %d', offset 0x%2.2x", val, table, addr, i, 0x15 + (i*len)); + } } } }