Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: fault-injection: fix non-working usage of negative values

Fault injection uses debugfs in a way that the provided values via sysfs
are interpreted as u64. Providing negative numbers results in an error:

/sys/kernel/debug/fail_function# echo -1 > times
sh: write error: Invalid argument

Update the docs and examples to use "printf %#x <val>" in these cases.
For "retval", reword the paragraph a little and fix a typo.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20210603125841.27436-1-wsa+renesas@sang-engineering.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Wolfram Sang and committed by
Jonathan Corbet
00574752 91a1265c

+14 -10
+14 -10
Documentation/fault-injection/fault-injection.rst
··· 78 78 79 79 - /sys/kernel/debug/fail*/times: 80 80 81 - specifies how many times failures may happen at most. 82 - A value of -1 means "no limit". 81 + specifies how many times failures may happen at most. A value of -1 82 + means "no limit". Note, though, that this file only accepts unsigned 83 + values. So, if you want to specify -1, you better use 'printf' instead 84 + of 'echo', e.g.: $ printf %#x -1 > times 83 85 84 86 - /sys/kernel/debug/fail*/space: 85 87 ··· 169 167 - ERRNO: retval must be -1 to -MAX_ERRNO (-4096). 170 168 - ERR_NULL: retval must be 0 or -1 to -MAX_ERRNO (-4096). 171 169 172 - - /sys/kernel/debug/fail_function/<functiuon-name>/retval: 170 + - /sys/kernel/debug/fail_function/<function-name>/retval: 173 171 174 - specifies the "error" return value to inject to the given 175 - function for given function. This will be created when 176 - user specifies new injection entry. 172 + specifies the "error" return value to inject to the given function. 173 + This will be created when the user specifies a new injection entry. 174 + Note that this file only accepts unsigned values. So, if you want to 175 + use a negative errno, you better use 'printf' instead of 'echo', e.g.: 176 + $ printf %#x -12 > retval 177 177 178 178 Boot option 179 179 ^^^^^^^^^^^ ··· 259 255 echo Y > /sys/kernel/debug/$FAILTYPE/task-filter 260 256 echo 10 > /sys/kernel/debug/$FAILTYPE/probability 261 257 echo 100 > /sys/kernel/debug/$FAILTYPE/interval 262 - echo -1 > /sys/kernel/debug/$FAILTYPE/times 258 + printf %#x -1 > /sys/kernel/debug/$FAILTYPE/times 263 259 echo 0 > /sys/kernel/debug/$FAILTYPE/space 264 260 echo 2 > /sys/kernel/debug/$FAILTYPE/verbose 265 261 echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait ··· 313 309 echo N > /sys/kernel/debug/$FAILTYPE/task-filter 314 310 echo 10 > /sys/kernel/debug/$FAILTYPE/probability 315 311 echo 100 > /sys/kernel/debug/$FAILTYPE/interval 316 - echo -1 > /sys/kernel/debug/$FAILTYPE/times 312 + printf %#x -1 > /sys/kernel/debug/$FAILTYPE/times 317 313 echo 0 > /sys/kernel/debug/$FAILTYPE/space 318 314 echo 2 > /sys/kernel/debug/$FAILTYPE/verbose 319 315 echo 1 > /sys/kernel/debug/$FAILTYPE/ignore-gfp-wait ··· 340 336 FAILTYPE=fail_function 341 337 FAILFUNC=open_ctree 342 338 echo $FAILFUNC > /sys/kernel/debug/$FAILTYPE/inject 343 - echo -12 > /sys/kernel/debug/$FAILTYPE/$FAILFUNC/retval 339 + printf %#x -12 > /sys/kernel/debug/$FAILTYPE/$FAILFUNC/retval 344 340 echo N > /sys/kernel/debug/$FAILTYPE/task-filter 345 341 echo 100 > /sys/kernel/debug/$FAILTYPE/probability 346 342 echo 0 > /sys/kernel/debug/$FAILTYPE/interval 347 - echo -1 > /sys/kernel/debug/$FAILTYPE/times 343 + printf %#x -1 > /sys/kernel/debug/$FAILTYPE/times 348 344 echo 0 > /sys/kernel/debug/$FAILTYPE/space 349 345 echo 1 > /sys/kernel/debug/$FAILTYPE/verbose 350 346