Skip to content

Commit

Permalink
Fixes for Cedric's static analysis notes. Issue #17.
Browse files Browse the repository at this point in the history
  • Loading branch information
evangreen committed Nov 4, 2016
1 parent e74c99c commit 2fa9de8
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 9 deletions.
3 changes: 2 additions & 1 deletion apps/efiboot/efiboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ Return Value:
if ((VariableDataSize % sizeof(UINT16)) != 0) {
fprintf(stderr,
"efiboot: Warning: BootOrder variable size was %d, not a "
"multiple of 2!\n");
"multiple of 2!\n",
VariableDataSize);
}

Count = VariableDataSize / sizeof(UINT16);
Expand Down
1 change: 1 addition & 0 deletions apps/lib/chalk/cif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ Return Value:
Count += 1;
}

va_end(ArgumentList);
Status = ChalkExecuteFunction(Interpreter, Function, List, ReturnValue);

CExecuteFunctionEnd:
Expand Down
1 change: 1 addition & 0 deletions apps/setup/win32/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Return Value:

PathCopy = strdup(Destination->Path);
if (PathCopy == NULL) {
free(IoHandle);
return NULL;
}

Expand Down
16 changes: 14 additions & 2 deletions apps/swiss/id.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,13 @@ Return Value:
if (((Options & ID_OPTION_EXCLUSIVE_MASK) == 0) ||
((Options & ID_OPTION_PRINT_NAMES) != 0)) {

SwGetUserNameFromId(UserId, &UserName);
if (SwGetUserNameFromId(UserId, &UserName) != 0) {

assert(UserName == NULL);

printf("%u", (unsigned int)UserId);
return;
}
}

//
Expand Down Expand Up @@ -558,7 +564,13 @@ Return Value:
if (((Options & ID_OPTION_EXCLUSIVE_MASK) == 0) ||
((Options & ID_OPTION_PRINT_NAMES) != 0)) {

SwGetGroupNameFromId(GroupId, &GroupName);
if (SwGetGroupNameFromId(GroupId, &GroupName) != 0) {

assert(GroupName == NULL);

printf("%u", (unsigned int)GroupId);
return;
}
}

//
Expand Down
12 changes: 10 additions & 2 deletions apps/swiss/ls/ls.c
Original file line number Diff line number Diff line change
Expand Up @@ -2130,8 +2130,16 @@ Return Value:
if (((Context->Flags & LS_OPTION_LONG_FORMAT) != 0) &&
((Context->Flags & LS_OPTION_PRINT_USER_GROUP_NUMBERS) == 0)) {

SwGetUserNameFromId(Stat->st_uid, &(NewFile->OwnerName));
SwGetGroupNameFromId(Stat->st_gid, &(NewFile->GroupName));
if (SwGetUserNameFromId(Stat->st_uid, &(NewFile->OwnerName)) != 0) {

assert(NewFile->OwnerName == NULL);
}

if (SwGetGroupNameFromId(Stat->st_gid, &(NewFile->GroupName)) !=
0) {

assert(NewFile->GroupName == NULL);
}
}

} else {
Expand Down
21 changes: 21 additions & 0 deletions apps/swiss/ps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,9 @@ Return Value:
case PsDataEffectiveUserIdentifier:
Result = SwGetUserNameFromId(Information->EffectiveUserId, &StringData);
if (Result != 0) {

assert(StringData == NULL);

DataAvailable = FALSE;
break;
}
Expand All @@ -1555,6 +1558,9 @@ Return Value:
case PsDataRealUserIdentifier:
Result = SwGetUserNameFromId(Information->RealUserId, &StringData);
if (Result != 0) {

assert(StringData == NULL);

DataAvailable = FALSE;
break;
}
Expand All @@ -1565,6 +1571,9 @@ Return Value:
case PsDataRealGroupIdentifier:
Result = SwGetGroupNameFromId(Information->RealGroupId, &StringData);
if (Result != 0) {

assert(StringData == NULL);

DataAvailable = FALSE;
break;
}
Expand All @@ -1577,6 +1586,9 @@ Return Value:
&StringData);

if (Result != 0) {

assert(StringData == NULL);

DataAvailable = FALSE;
break;
}
Expand Down Expand Up @@ -2131,6 +2143,9 @@ Return Value:
&GroupName);

if (Result != 0) {

assert(GroupName == NULL);

continue;
}
}
Expand Down Expand Up @@ -2237,6 +2252,9 @@ Return Value:
&UserName);

if (Result != 0) {

assert(UserName == NULL);

continue;
}
}
Expand Down Expand Up @@ -2283,6 +2301,9 @@ Return Value:
&UserName);

if (Result != 0) {

assert(UserName == NULL);

continue;
}
}
Expand Down
2 changes: 2 additions & 0 deletions apps/swiss/ssdaemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,9 +932,11 @@ Return Value:
}

if (fscanf(File, "%u", &ScannedPid) != 1) {
fclose(File);
return EINVAL;
}

fclose(File);
SsDaemonMatchPid(Context, ScannedPid);
return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/dma/bcm2709/dmab2709.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,6 @@ Return Value:
PHYSICAL_ADDRESS PreviousAddress;
PDMA_BCM2709_CONTROL_BLOCK PreviousControlBlock;
UINTN Remaining;
UINTN Size;
KSTATUS Status;
UINTN TransferSize;

Expand Down Expand Up @@ -1508,7 +1507,6 @@ Return Value:
FragmentOffset = 0;
}

Size += BytesThisRound;
TransferSize += BytesThisRound;
Remaining -= BytesThisRound;
PreviousAddress += BytesThisRound;
Expand Down
2 changes: 1 addition & 1 deletion kernel/armv7/prochw.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ Return Value:
}

ExceptionStacks = ArP0ExceptionStacks;
InterruptTable = ArP0InterruptTable;
if (PhysicalMode == FALSE) {

//
// Use the globals if this is the boot processor because the memory
// subsystem is not yet online.
//

InterruptTable = ArP0InterruptTable;
if (ProcessorStructures == NULL) {
ProcessorBlock = &ArP0ProcessorBlock;

Expand Down
8 changes: 7 additions & 1 deletion uefi/plat/panda/init/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,13 @@ Return Value:
UINT32 Mask;
UINT32 Register;

Mask = 1 << BitCount;
if (BitCount == 32) {
Mask = 0;

} else {
Mask = 1 << BitCount;
}

Mask -= 1;
Register = OMAP4_READ32(Address) & ~(Mask << StartBit);
Register |= Value << StartBit;
Expand Down
4 changes: 4 additions & 0 deletions uefi/plat/veyron/fwbuild/fwbuild.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ Return Value:
fclose(FirmwareImage);
}

if (KeyBlockFile != NULL) {
fclose(KeyBlockFile);
}

if (FirmwareImageBuffer != NULL) {
free(FirmwareImageBuffer);
}
Expand Down

0 comments on commit 2fa9de8

Please sign in to comment.