Kennedy wrote that the searches are necessary for the safety both of corrections officers and their prisoners.