On the ℓ-adic Galois representations attached to nonsimple abelian varieties