From 084930e1e4e76ddb55540ee932fb9d839766bc59 Mon Sep 17 00:00:00 2001 From: Subhash Jadavani Date: Wed, 24 Sep 2014 17:15:17 -0700 Subject: [PATCH] scsi: ufs_quirks: fix card model string copy Product name string (referred as "model" string in driver) starts from offset 02h in Product Name String Descriptor but currently we copy the product name from 00h offset of the descriptor which is incorrect. This change fixes the above problem by copying the product name from the right offset of the Product Name String Descriptor. Change-Id: I0ab2ecc19c7383d9782ba57af6441175d2ecda46 Signed-off-by: Subhash Jadavani --- drivers/scsi/ufs/ufs_quirks.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufs_quirks.c b/drivers/scsi/ufs/ufs_quirks.c index 04197c61bdc2..9f5adc0186b4 100644 --- a/drivers/scsi/ufs/ufs_quirks.c +++ b/drivers/scsi/ufs/ufs_quirks.c @@ -48,7 +48,12 @@ int ufs_get_device_info(struct ufs_hba *hba, struct ufs_card_info *card_data) goto out; str_desc_buf[QUERY_DESC_STRING_MAX_SIZE] = '\0'; - strlcpy(card_data->model, str_desc_buf, MAX_MODEL_LEN + 1); + strlcpy(card_data->model, (str_desc_buf + QUERY_DESC_HDR_SIZE), + min_t(u8, str_desc_buf[QUERY_DESC_LENGTH_OFFSET], + MAX_MODEL_LEN)); + /* Null terminate the model string */ + card_data->model[MAX_MODEL_LEN] = '\0'; + out: return err; }