The Messenger of Allah ﷺ said, "There was a man among those who came before you who used to commit sins. When death approached him, he said to his family, 'When I die, burn my body, then grind it to dust, then scatter the dust into the sea on a stormy, windy day.'When he died, they did as he had instructed. But Allah gathered him together in His hand and said to him, 'What made you do what you did?'He replied, 'Fear of You.'So Allah said, 'I have forgiven you.'"
قال رسول الله ﷺ: كان رجل ممن كان قبلكم يعمل بالمعاصي، فلما حضره الموت قال لأهله: إذا أنا مت فأحرقوني، ثم اطحنوني، ثم ذروني في البحر في يوم ريح عاصف. قال: فلما مات فعلوا، قال: فجمعه الله عز وجل في يده قال له: ما حملك على ما صنعت؟ قال: خوفك، قال: فإني قد غفرت لك.
Ahmad (23253) narrated it from Abu Muawiya, who said, Abu Malik Ashjai narrated to us, from Rabi bin Harash, from Abu Masud Ansari and Huzaifa, and they both mentioned it. Its chain of transmission is sahih. The hadith mentioned was narrated by Huzaifa, and Abu Masud Ansari confirmed it as true, as is made clear in the account from Ahmad (17064) in a longer context.