Is this safe?

Ka

My baby boy favors one side of his head and its causing his head to get a flat spot. I've been trying to turn his head when hes sleeping but he just turns it right back. So today I rolled up a swaddle and put it under his head, but I'm worried its not safe to have it in there with him. I am watching him but I wouldn't want to do this over night right?