Commit 14a2276
committed
media: s5p-jpeg: prevent buffer overflows
The current logic allows word to be less than 2. If this happens,
there will be buffer overflows, as reported by smatch. Add extra
checks to prevent it.
While here, remove an unused word = 0 assignment.
Fixes: 6c96dbb ("[media] s5p-jpeg: add support for 5433")
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>1 parent 458ea1c commit 14a2276
1 file changed
+11
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
775 | 775 | | |
776 | 776 | | |
777 | 777 | | |
778 | | - | |
779 | | - | |
780 | 778 | | |
781 | 779 | | |
782 | | - | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
783 | 786 | | |
784 | 787 | | |
785 | 788 | | |
| |||
1058 | 1061 | | |
1059 | 1062 | | |
1060 | 1063 | | |
| 1064 | + | |
1061 | 1065 | | |
1062 | 1066 | | |
1063 | 1067 | | |
| |||
1145 | 1149 | | |
1146 | 1150 | | |
1147 | 1151 | | |
1148 | | - | |
| 1152 | + | |
1149 | 1153 | | |
1150 | 1154 | | |
1151 | 1155 | | |
| |||
1176 | 1180 | | |
1177 | 1181 | | |
1178 | 1182 | | |
1179 | | - | |
| 1183 | + | |
1180 | 1184 | | |
1181 | 1185 | | |
1182 | 1186 | | |
| |||
1189 | 1193 | | |
1190 | 1194 | | |
1191 | 1195 | | |
1192 | | - | |
| 1196 | + | |
1193 | 1197 | | |
1194 | 1198 | | |
1195 | 1199 | | |
| |||
1214 | 1218 | | |
1215 | 1219 | | |
1216 | 1220 | | |
| 1221 | + | |
1217 | 1222 | | |
1218 | 1223 | | |
1219 | 1224 | | |
| |||
0 commit comments