Terminal 4 and 4S are connected airside by a train (5min), no need to go through security only passport control as you are leaving the EU.
Your bag will be checked through.
You will leave your roll aboard at the bottom of the stairs of the CRJ in Marseille and collect it at the bottom of the stairs in Madrid.
45 min is more than enough time to connect.