Commit 5ab2b18
committed
btrfs: factor out validation of btrfs_ioctl_vol_args::name
The validation of vol args name in several ioctls is not done properly.
a terminating NUL is written to the end of the buffer unconditionally,
assuming that this would be the last place in case the buffer is used
completely. This does not communicate back the actual error (either an
invalid or too long path).
Factor out all such cases and use a helper to do the verification,
simply look for NUL in the buffer. There's no expected practical change,
the size of buffer is 4088, this is enough for most paths or names.
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent f33163e commit 5ab2b18
3 files changed
Lines changed: 35 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
973 | 973 | | |
974 | 974 | | |
975 | 975 | | |
| 976 | + | |
| 977 | + | |
976 | 978 | | |
977 | 979 | | |
978 | 980 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
230 | 237 | | |
231 | 238 | | |
232 | 239 | | |
| |||
1126 | 1133 | | |
1127 | 1134 | | |
1128 | 1135 | | |
1129 | | - | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
1130 | 1140 | | |
1131 | 1141 | | |
1132 | 1142 | | |
| |||
1326 | 1336 | | |
1327 | 1337 | | |
1328 | 1338 | | |
1329 | | - | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
1330 | 1342 | | |
1331 | 1343 | | |
1332 | 1344 | | |
1333 | 1345 | | |
1334 | 1346 | | |
| 1347 | + | |
1335 | 1348 | | |
1336 | 1349 | | |
1337 | 1350 | | |
| |||
2464 | 2477 | | |
2465 | 2478 | | |
2466 | 2479 | | |
2467 | | - | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
2468 | 2484 | | |
2469 | 2485 | | |
2470 | 2486 | | |
| |||
2675 | 2691 | | |
2676 | 2692 | | |
2677 | 2693 | | |
2678 | | - | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
2679 | 2698 | | |
2680 | 2699 | | |
2681 | 2700 | | |
2682 | 2701 | | |
2683 | 2702 | | |
| 2703 | + | |
2684 | 2704 | | |
2685 | 2705 | | |
2686 | 2706 | | |
| |||
2772 | 2792 | | |
2773 | 2793 | | |
2774 | 2794 | | |
2775 | | - | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
2776 | 2799 | | |
2777 | 2800 | | |
2778 | 2801 | | |
| |||
2799 | 2822 | | |
2800 | 2823 | | |
2801 | 2824 | | |
| 2825 | + | |
2802 | 2826 | | |
2803 | 2827 | | |
2804 | 2828 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2201 | 2201 | | |
2202 | 2202 | | |
2203 | 2203 | | |
2204 | | - | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
2205 | 2207 | | |
2206 | 2208 | | |
2207 | 2209 | | |
| |||
2243 | 2245 | | |
2244 | 2246 | | |
2245 | 2247 | | |
| 2248 | + | |
2246 | 2249 | | |
2247 | 2250 | | |
2248 | 2251 | | |
| |||
0 commit comments