Sayyiduna Hakim bin Hizam (may Allah be pleased with him) narrates: He submitted, "O Messenger of Allah! What is your opinion about those deeds which I performed as acts of goodness during the time of ignorance, such as maintaining ties of kinship, freeing slaves, and giving charity—will there be any reward for them?" The Prophet (peace and blessings of Allah be upon him) said: "You have accepted Islam as a reward for the deeds you did before."
Hadith Referenceصحیح ابن حبان / كتاب البر والإحسان / 329
Hadith Gradingفضيلة الشيخ الإمام محمد ناصر الدين الألبانيصحيح - «الصحيحة» (248): ق.فضيلة الشيخ العلّامة شُعيب الأرناؤوطإسناده صحيح، عمرو بن عثمان روى له أبوداود والنسائي، وثقه غير واحد، وقال أبو حاتم: صدوق، وأبوه عثمان بن سعيد الحمصي ثقة، روى له أبو داود والنسائي أيضاً، ومن فوقهما ثقات من رجال الشيخين.