Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 0b700d2

Browse files
RuffaloLavoisiergregkh
authored andcommitted
comedi: ni_routing: tools: Check when the file could not be opened
[ Upstream commit 5baeb15 ] - After fopen check NULL before using the file pointer use Signed-off-by: Ruffalo Lavoisier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 0be5282 commit 0b700d2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ int main(void)
140140
{
141141
FILE *fp = fopen("ni_values.py", "w");
142142

143+
if (fp == NULL) {
144+
fprintf(stderr, "Could not open file!");
145+
return -1;
146+
}
147+
143148
/* write route register values */
144149
fprintf(fp, "ni_route_values = {\n");
145150
for (int i = 0; ni_all_route_values[i]; ++i)

0 commit comments

Comments
 (0)