Re: [PATCH] mpt3sas: Ensure the connector_name string is NUL-terminated
From: Martin K. Petersen
Date: Mon Aug 08 2016 - 21:10:41 EST
>>>>> "Calvin" == Calvin Owens <calvinowens@xxxxxx> writes:
Calvin> We blindly trust the hardware to give us NUL-terminated strings,
Calvin> which is a bad idea because it doesn't always do that. For
Calvin> example:
Calvin> [ 481.184784] mpt3sas_cm0: enclosure level(0x0000), connector
Calvin> name( \x3)
Calvin> In this case, connector_name is four spaces. We got lucky here
Calvin> because the 2nd byte beyond our character array happens to be a
Calvin> NUL. Fix this by explicitly writing '\0' to the end of the
Calvin> string to ensure we don't run off the edge of the world in
Calvin> printk().
Applied to 4.9/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering