Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
yoctos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISC3
sys_advanced
yoctos
Commits
e43e63fd
Verified
Commit
e43e63fd
authored
9 months ago
by
iliya.saroukha
Browse files
Options
Downloads
Patches
Plain Diff
fix: preventing "double-free" condition of a frame
parent
2deb7684
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernel/mem/frame.c
+4
-24
4 additions, 24 deletions
kernel/mem/frame.c
with
4 additions
and
24 deletions
kernel/mem/frame.c
+
4
−
24
View file @
e43e63fd
...
...
@@ -42,7 +42,7 @@ static void frame_mark_free(int frame) {
allocator
.
nb_frames_used
--
;
}
static
bool
is_frame_free
(
int
frame
)
{
bool
is_frame_free
(
int
frame
)
{
int
idx_bmp
=
frame
/
8
;
return
!
(
allocator
.
bitmap
[
idx_bmp
]
&
(
1
<<
(
frame
%
8
)));
}
...
...
@@ -71,8 +71,10 @@ void frame_init(uint_t RAM_in_KB) {
}
void
frame_free
(
void
*
frame_addr
)
{
if
(
!
is_frame_free
(
ADDR_TO_FRAME_NB
(
frame_addr
)))
{
frame_mark_free
(
ADDR_TO_FRAME_NB
(
frame_addr
));
}
}
uint_t
frame_total_free
(
void
)
{
return
BITMAP_SIZE
*
8
-
allocator
.
nb_frames_used
;
...
...
@@ -117,25 +119,3 @@ void dbg_frame_allocator(struct terminal_t *term) {
return
;
}
}
/*void dbg_frame_bmp(struct terminal_t *term) {*/
/* if (term_set_colours(term, YELLOW, BLACK) != 0) {*/
/* return;*/
/* }*/
/**/
/* int alloc = 0;*/
/* for (uint_t i = 0; i < BITMAP_SIZE; i++) {*/
/* if (!allocator.bitmap[i]) {*/
/* break;*/
/* }*/
/**/
/* alloc += allocator.bitmap[i];*/
/* kprintf(term, "%d ", allocator.bitmap[i]);*/
/* }*/
/**/
/* kprintf(term, "Number of frames allocated = %d\n", alloc);*/
/**/
/* if (term_set_colours(term, WHITE, BLACK) != 0) {*/
/* return;*/
/* }*/
/*}*/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment