History

device property: Fix the length used in PROPERTY_ENTRY_STRING()

With string type property entries we need to use sizeof(const char *) instead of the number of characters as the length of the entry. If the string was shorter then sizeof(const char *), attempts to read it would have failed with -EOVERFLOW. The problem has been hidden because all build-in string properties have had a string longer then 8 characters until now.

Heikki Krogerus committed 7 years ago

Commit 2b6e4921 parent f17b5f01 file · +1 −1Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/property.h+1−1
@@ -258,7 +258,7 @@ struct property_entry { · 257 unmodified lines
258#define PROPERTY_ENTRY_STRING(_name_, _val_) \258#define PROPERTY_ENTRY_STRING(_name_, _val_) \
259(struct property_entry) { \259(struct property_entry) { \
260 .name = _name_, \260 .name = _name_, \
261 .length = sizeof(_val_), \261 .length = sizeof(const char *), \
262 .type = DEV_PROP_STRING, \262 .type = DEV_PROP_STRING, \
263 { .value = { .str = _val_ } }, \263 { .value = { .str = _val_ } }, \
264}264}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t