The sum of the oxidation numbers of all the carbons in C6H5CHO is
-4
In benzaldehyde, the carbon atoms in the benzene ring would all have the same oxidation number. This is as they are all connected to each other. H atom would have an oxidation number of +1 always, hence all the 5 carbon atoms bound to H inside the benzene ring would have a -1 oxidation number. The C atom in the benzene ring that has no H atoms, and is bound to only C atoms, 2 inside the ring, and the other CHO group would clearly be 0! Since there is no electronegativity difference between this carbon and the others.
So far, we have 5 C atoms at -1, one C atom at 0 from the ring.
Let us now analyze the CHO group, here, H is +1, O is -2 and the other C bonded to this is 0. For the total oxidation number to be 0, this C in the CHO group would have a +1 oxidation state making the sum = -4.