Commit ea3ad78
committed
mtd: spi-nor: fix iteration over smpt array
Iterate over smpt array using its starting address and length
instead of the blind iterations that used data found in the array.
This prevents possible memory accesses outside of the smpt array
boundaries in case software, or manufacturers, misrepresent smpt
array fields.
Fixes: b038e8e ("mtd: spi-nor: parse SFDP Sector Map Parameter Table")
Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
(cherry picked from commit c797bd8)
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>1 parent e432a16 commit ea3ad78
1 file changed
Lines changed: 30 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2803 | 2803 | | |
2804 | 2804 | | |
2805 | 2805 | | |
| 2806 | + | |
2806 | 2807 | | |
2807 | | - | |
| 2808 | + | |
| 2809 | + | |
2808 | 2810 | | |
2809 | 2811 | | |
2810 | | - | |
| 2812 | + | |
2811 | 2813 | | |
| 2814 | + | |
2812 | 2815 | | |
2813 | 2816 | | |
2814 | 2817 | | |
| |||
2817 | 2820 | | |
2818 | 2821 | | |
2819 | 2822 | | |
2820 | | - | |
2821 | 2823 | | |
2822 | | - | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
2823 | 2828 | | |
2824 | 2829 | | |
2825 | 2830 | | |
| |||
2835 | 2840 | | |
2836 | 2841 | | |
2837 | 2842 | | |
2838 | | - | |
2839 | 2843 | | |
2840 | 2844 | | |
2841 | | - | |
2842 | | - | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
2843 | 2863 | | |
2844 | | - | |
| 2864 | + | |
| 2865 | + | |
2845 | 2866 | | |
2846 | 2867 | | |
2847 | 2868 | | |
2848 | 2869 | | |
2849 | | - | |
2850 | 2870 | | |
2851 | 2871 | | |
2852 | 2872 | | |
| |||
2968 | 2988 | | |
2969 | 2989 | | |
2970 | 2990 | | |
2971 | | - | |
| 2991 | + | |
2972 | 2992 | | |
2973 | 2993 | | |
2974 | 2994 | | |
| |||
0 commit comments