Skip to content

logging: init strdup mem_slab with aligned buffer size #10506

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

Conversation

mike-scott
Copy link
Contributor

We are using a non-32-bit aligned value as the block size
when initializing the strdup mem_slab for Logger.

When the non-aligned pointer is being freed, it's converted
to a u32_t and this generates the following:
***** USAGE FAULT *****
Unaligned memory access

Let's use the aligned buffer size as the block size instead.

Signed-off-by: Michael Scott [email protected]

We are using a non-32-bit aligned value as the block size
when initializing the strdup mem_slab for Logger.

When the non-aligned pointer is being freed, it's converted
to a u32_t and this generates the following:
***** USAGE FAULT *****
  Unaligned memory access

Let's use the aligned buffer size as the block size instead.

Signed-off-by: Michael Scott <[email protected]>
@mike-scott mike-scott requested a review from jukkar October 11, 2018 01:42
@mike-scott mike-scott self-assigned this Oct 11, 2018
@mike-scott mike-scott added bug The issue is a bug, or the PR is fixing a bug area: Logging labels Oct 11, 2018
@mike-scott mike-scott added this to the v1.14.0 milestone Oct 11, 2018
@codecov-io
Copy link

Codecov Report

Merging #10506 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #10506   +/-   ##
=======================================
  Coverage   53.18%   53.18%           
=======================================
  Files         210      210           
  Lines       25816    25816           
  Branches     5682     5682           
=======================================
  Hits        13731    13731           
  Misses       9780     9780           
  Partials     2305     2305
Impacted Files Coverage Δ
subsys/logging/log_core.c 76.92% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2a103ea...1d28575. Read the comment docs.

@mike-scott mike-scott added the priority: high High impact/importance bug label Oct 11, 2018
@jukkar
Copy link
Member

jukkar commented Oct 11, 2018

This is fixing issue in networking shell, so merging it now.

@jukkar jukkar merged commit 5184444 into zephyrproject-rtos:master Oct 11, 2018
@mike-scott mike-scott deleted the master-fix-logger-strdup-alignment branch October 18, 2018 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Logging bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants