os: fix build warnings with name/attr len checks (fixes 8889)

Verify this passes gitbuilders before merge