Commit 90f1659
bpftool: explicit errno handling in skeletons
Andrii noticed that since f97b8b9 (bpftool: Fix a bug in subskeleton code generation)
the subskeleton code allows bpf_object__destroy_subskeleton to overwrite
the errno that subskeleton__open would return with. While this is not
currently an issue, let's make it future-proof.
This patch explicitly tracks err in subskeleton__open and skeleton__create
(i.e. calloc failure is explicitly ENOMEM) and ensures that errno
is -err on the error return path. The skeleton code had to be changed
since maps and progs codegen is shared with subskeletons.
Signed-off-by: Delyan Kratunov <delyank@fb.com>1 parent f56003f commit 90f1659
1 file changed
+15
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
831 | | - | |
| 831 | + | |
| 832 | + | |
832 | 833 | | |
| 834 | + | |
833 | 835 | | |
834 | 836 | | |
835 | 837 | | |
| |||
870 | 872 | | |
871 | 873 | | |
872 | 874 | | |
873 | | - | |
| 875 | + | |
| 876 | + | |
874 | 877 | | |
| 878 | + | |
875 | 879 | | |
876 | 880 | | |
877 | 881 | | |
| |||
1182 | 1186 | | |
1183 | 1187 | | |
1184 | 1188 | | |
| 1189 | + | |
1185 | 1190 | | |
1186 | 1191 | | |
1187 | | - | |
| 1192 | + | |
| 1193 | + | |
1188 | 1194 | | |
| 1195 | + | |
1189 | 1196 | | |
1190 | 1197 | | |
1191 | 1198 | | |
| |||
1206 | 1213 | | |
1207 | 1214 | | |
1208 | 1215 | | |
1209 | | - | |
| 1216 | + | |
1210 | 1217 | | |
1211 | 1218 | | |
1212 | 1219 | | |
| |||
1466 | 1473 | | |
1467 | 1474 | | |
1468 | 1475 | | |
1469 | | - | |
| 1476 | + | |
1470 | 1477 | | |
1471 | 1478 | | |
1472 | 1479 | | |
1473 | 1480 | | |
1474 | | - | |
| 1481 | + | |
1475 | 1482 | | |
1476 | 1483 | | |
1477 | 1484 | | |
| |||
1483 | 1490 | | |
1484 | 1491 | | |
1485 | 1492 | | |
1486 | | - | |
| 1493 | + | |
1487 | 1494 | | |
1488 | 1495 | | |
1489 | 1496 | | |
| |||
1538 | 1545 | | |
1539 | 1546 | | |
1540 | 1547 | | |
| 1548 | + | |
1541 | 1549 | | |
1542 | 1550 | | |
1543 | 1551 | | |
| |||
0 commit comments