Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get text segment stubs seem to be bugged #313

Closed
skliper opened this issue Oct 14, 2021 · 1 comment · Fixed by #314 or #318
Closed

Get text segment stubs seem to be bugged #313

skliper opened this issue Oct 14, 2021 · 1 comment · Fixed by #314 or #318
Assignees

Comments

@skliper
Copy link
Contributor

skliper commented Oct 14, 2021

Describe the bug
Looks like the stubs are checking input values vs successful UT_GetDataBuffer, which doesn't make sense to me since it's used to decide if the buffer values should be used or not:

PSP/ut-stubs/ut_psp_stubs.c

Lines 559 to 570 in 1bd7bd9

UT_GetDataBuffer(UT_KEY(CFE_PSP_GetCFETextSegmentInfo), &TempAddr, &TempSize, NULL);
if (*PtrToCFESegment == 0)
{
/* Backup -- Set the pointer and size to anything */
*PtrToCFESegment = (cpuaddr)&LocalTextSegment;
*SizeOfCFESegment = sizeof(LocalTextSegment);
}
else
{
*PtrToCFESegment = (cpuaddr)TempAddr;
*SizeOfCFESegment = TempSize;
}

PSP/ut-stubs/ut_psp_stubs.c

Lines 604 to 615 in 1bd7bd9

UT_GetDataBuffer(UT_KEY(CFE_PSP_GetKernelTextSegmentInfo), &TempAddr, &TempSize, NULL);
if (*PtrToKernelSegment == 0)
{
/* Backup -- Set the pointer and size to anything */
*PtrToKernelSegment = (cpuaddr)&LocalTextSegment;
*SizeOfKernelSegment = sizeof(LocalTextSegment);
}
else
{
*PtrToKernelSegment = (cpuaddr)TempAddr;
*SizeOfKernelSegment = TempSize;
}

To Reproduce
You'll get an uninitialized error on the input pointer if not already set, if it's nonzero and you don't set the buffer that will utilize the Temp values which doesn't make sense to me.

Expected behavior
Use buffer values if passed in, otherwise use local dummy segment.

System observed on:
N/A

Reporter Info
Jacob Hageman - NASA/GSFC

@jphickey jphickey self-assigned this Oct 18, 2021
@jphickey
Copy link
Contributor

I admit this might be related to the alias warning fix I put in a while back. It should be checking the TempAddr, not the input.

jphickey added a commit to jphickey/PSP that referenced this issue Oct 18, 2021
Checks the correct local variable (TempAddr) to see if the
data buffer address was set by the test case
astrogeco added a commit to astrogeco/PSP that referenced this issue Oct 20, 2021
Fix nasa#313, check the address in PSP get segment stubs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants