(Imam Bukhari narrates that) Ibn Salam narrated to us, he says that Muhammad bin Fudail informed us, he says: Yahya bin Sa'id narrated to us, from Abu Salamah, from Abu Hurairah, that the Messenger of Allāh ﷺ said:
Whoever fasted Ramadan with faith and seeking reward, his previous sins will be forgiven.
حَدَّثَنَا ابْنُ سَلَامٍ قَالَ: أَخْبَرَنَا مُحَمَّدُ بْنُ فُضَيْلٍ قَالَ: حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ قَالَ: قَالَ رَسُولُ اللهِ ﷺ
مَنْ صَامَ رَمَضَانَ إِيمَانًا وَاحْتِسَابًا غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ.
Reference: Sahih Al Bukhari 38