Colin Ian King
2324985aa7
selftests/resctrl: Fix null pointer dereference on open failed
...
[ Upstream commit c7b607fa93 ]
Currently if opening /dev/null fails to open then file pointer fp
is null and further access to fp via fprintf will cause a null
pointer dereference. Fix this by returning a negative error value
when a null fp is detected.
Detected using cppcheck static analysis:
tools/testing/selftests/resctrl/fill_buf.c:124:6: note: Assuming
that condition '!fp' is not redundant
if (!fp)
^
tools/testing/selftests/resctrl/fill_buf.c:126:10: note: Null
pointer dereference
fprintf(fp, "Sum: %d ", ret);
Fixes: a2561b12fe ("selftests/resctrl: Add built in benchmark")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com >
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2022-06-09 10:22:51 +02:00
..
2021-09-21 18:12:03 +01:00
2022-06-09 10:22:40 +02:00
2021-02-08 17:04:41 -07:00
2020-03-25 11:50:48 +01:00
2022-04-13 20:59:27 +02:00
2022-02-23 12:03:18 +01:00
2021-11-18 19:16:21 +01:00
2021-08-31 11:00:02 -06:00
2021-12-22 09:32:51 +01:00
2021-04-02 16:41:08 +02:00
2021-02-08 16:25:53 -07:00
2022-05-12 12:30:20 +02:00
2020-03-25 11:50:48 +01:00
2022-02-23 12:03:13 +01:00
2021-07-21 13:46:36 +02:00
2021-07-21 16:11:42 +02:00
2020-06-29 10:02:23 +02:00
2022-03-08 19:12:31 +01:00
2022-02-08 18:34:12 +01:00
2021-11-25 09:48:34 +01:00
2020-03-25 11:50:48 +01:00
2020-11-10 14:41:32 -07:00
2021-02-08 16:32:43 -07:00
2020-03-25 11:50:48 +01:00
2020-03-25 11:50:48 +01:00
2019-08-29 12:45:30 -04:00
2020-08-12 10:58:01 -07:00
2020-12-08 23:30:04 +09:00
2022-05-12 12:30:24 +02:00
2021-04-22 12:22:11 -07:00
2021-05-19 15:05:11 +02:00
2020-08-27 15:27:24 +02:00
2022-04-08 14:23:18 +02:00
2020-03-25 11:50:48 +01:00
2020-03-25 11:50:48 +01:00
2022-03-16 14:23:42 +01:00
2021-07-12 14:20:01 -06:00
2022-02-23 12:03:05 +01:00
2020-08-27 16:06:47 -04:00
2022-02-23 12:03:21 +01:00
2021-07-26 14:45:19 +02:00
2022-04-20 09:34:12 +02:00
2021-09-16 13:55:51 +01:00
2022-05-25 09:57:35 +02:00
2022-02-23 12:03:10 +01:00
2020-05-08 09:42:14 -06:00
2020-06-05 20:02:09 -04:00
2022-02-23 12:03:05 +01:00
2021-05-18 16:20:54 -05:00
2020-07-06 15:59:07 -06:00
2022-02-23 12:03:18 +01:00
2022-01-27 11:05:03 +01:00
2020-03-25 11:50:48 +01:00
2021-06-05 08:58:11 -07:00
2020-05-30 10:34:02 -07:00
2020-07-20 18:04:59 -07:00
2020-09-23 10:19:25 -06:00
2022-04-08 14:24:16 +02:00
2022-06-09 10:22:51 +02:00
2021-04-30 14:14:03 -05:00
2020-12-07 14:09:45 -07:00
2022-02-23 12:03:04 +01:00
2021-08-26 15:15:24 -06:00
2021-11-18 19:16:14 +01:00
2022-05-12 12:30:14 +02:00
2022-04-08 14:23:06 +02:00
2021-05-19 12:38:17 +02:00
2020-03-25 11:50:48 +01:00
2020-03-25 11:50:48 +01:00
2021-06-07 18:39:43 -06:00
2019-05-21 10:50:46 +02:00
2021-08-31 10:58:00 -06:00
2021-02-06 00:21:42 +01:00
2020-06-09 10:03:12 -07:00
2021-08-04 12:42:27 +01:00
2021-04-21 22:52:32 +10:00
2021-06-07 19:18:52 -06:00
2020-03-25 11:50:48 +01:00
2020-07-06 14:20:35 -06:00
2020-07-06 15:59:07 -06:00
2019-05-21 10:50:46 +02:00
2022-02-23 12:03:06 +01:00
2022-05-18 10:26:50 +02:00
2020-03-25 11:50:48 +01:00
2021-12-08 09:04:46 +01:00
2022-04-08 14:23:11 +02:00
2022-02-23 12:03:05 +01:00
2020-04-03 13:12:26 -07:00
2020-05-19 16:11:46 -06:00
2021-02-15 11:43:28 +01:00
2022-02-23 12:03:04 +01:00
2019-11-07 14:43:27 -07:00
2021-02-15 11:07:42 +01:00
2020-08-05 10:28:25 -07:00
2021-09-15 10:34:21 -06:00
2022-06-09 10:22:50 +02:00
2020-11-10 14:51:39 -07:00