The 215/40/17 has a 215mm width. 40% of that 215mm is the size of the sidewall (distance from rim to the top of the tire). And the 205/45/17 is 205 mm wide and 45% is sidewall height. For best protection against potholes and such, you want more sidewall.
So for the 215/40: (.4)(215mm)=86mm
and the 205/45: (.45)(205mm)=92.25mm
The taller side wall goes to the 205/45/17. I'd suggest this tire anyway due to possible rubbing issues with a big drop such as the sportlines. According to tirerack.com, they recommend the 205/45/17 as the size to get when upgrading to 17's (for non-SVT's).
As for diameters:
205/45/17 = 24.3"
215/40/17 = 23.8"
The 215/40 is less likely to rub, due to the fact it is a half inch shorter than the 205/45. But it's only an extra .25 inch on top of the wheel into the wheelwell (it is half of the height difference all the way around because half is on top of the axle and the other half below it.) Do I think the extra .25 will make a difference, probably not, but there is a possibility.
Because you want "more protection from pot holes and/or more protection for the lip" I'd go with the 205/45/17. And thats my final answer.
i have 215/45's with sportlines and they rub on the back just a little bit.... if you go over a large bump at a higher speed... or a big dip in the road that will make you bonce around anyways... and around hard cornering they rub but dont affect anything or do any damage, they just rub a little but if you want to keep your rims safer go with them and they defiantly make the gap like very very small
I have a 40mm offset with 17"s and have 2.2" drop in front and 2.0" in rear and have 215/45's and i use to rub, but I tweek my fender lips out so they would rub anymore. Just be carefull though you will need to get the fenders repainted if you tweek them to far. Just do some measuring and figure out how much rubber you can cram under the fenders if you don't want to midfy the body any.
I run on 205/55 R16s in the winter and they just barely rub on the fender splash walls with the wheel cut to the stop...you're not going to rub with 205/45s or 215/40s. And having an extra ~6mm of sidewall isn't going to do much if you hit a pothole that's capable of damaging a tire. I'd go with the 215/40s just from the added tire width...they'll give you an extra 4cm of contact with the road that you wouldn't have with the 205s.
i have 215-45-17's Kumhos with the SVT suspension, full tank n weight in the back it will rub on dips n hard cornering but thats it...normally with full tank n no wieght it's fine...i think 215-45-17 is the best choice