From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 631E612E1E9 for ; Mon, 4 May 2026 18:10:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777918257; cv=none; b=D9flXsYKE4ZQOLJWFzrqbrY8ZwmcfEdOHavbSxMe9HiUMLvZ8EEa9c8lz6bTqOvkwHxE1DqNnn9AbkhCH5bI7CEpckB86KB/225afew2aCf3XLRtzszUNyu86kLY29RoOynsYCgyN3sWU0+7wSWHTXuZHQqYlxL7E2ZI9Ygq7s0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777918257; c=relaxed/simple; bh=TWi0XDqLrqy0ypbn9Sd51p9cUWaA/5BD8JIRlXP6gvg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=V4hM5n7qQ8yuMyNDb4QVDlCMvdK5R7GN2qUmvnKZzE6pcfvFzdqWJS9mNpN5lyuNss4DMq6rT0mB15dapsmVxpa/XeTfZbwxzx+vaRihAn0DEpVdt7jjKa1fhEe9pr5MYBZg+KHzkgEq7gljK0h15ITd3eHlmjRtXBCvhwlCv4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=rvZaY1AY; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="rvZaY1AY" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1777918254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=c3G4IaxkFcmqbQ4LYPwOZ+6xz1d+fbfGkXZaawTfXHM=; b=rvZaY1AYmJtW8uy74xP10gHLljM5ITCAUBzOeD+bvuoFX9jVSpZqakTW8z1cJ80ZMhMA10 RGJQpDfJJfBGDK3jP9O9JUAO7Brfr/HxQO/2c7W8MfnHwPzPvozBirEQbSBnD+FzFCdY1y jyl75BBxhySFHcEkllTQb0MbnLbtZGk= From: Thorsten Blum To: Sudip Mukherjee Cc: Thorsten Blum , linux-kernel@vger.kernel.org Subject: [PATCH RESEND] parport: replace kmalloc + strcpy with kstrdup in parse_data Date: Mon, 4 May 2026 20:10:41 +0200 Message-ID: <20260504181040.142616-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1031; i=thorsten.blum@linux.dev; h=from:subject; bh=TWi0XDqLrqy0ypbn9Sd51p9cUWaA/5BD8JIRlXP6gvg=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDJk/HircmTyFkTPK8zHT6TBvW2/x2QeP11ypCF+izfpG6 bHjquw7HaUsDGJcDLJiiiwPZv2Y4VtaU7nJJGInzBxWJpAhDFycAjARqXRGhoXOKryqPd391X8i /ae8m9ZdoCp0YV7B3eS29wVJq2PKTzMynK3X5fntvtpw0ZQdfbt/dC10ulQgF8Uj4PlJRs99hrs OBwA= X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Replace kmalloc() followed by strcpy() with a single call to kstrdup() to simplify parse_data(). Signed-off-by: Thorsten Blum --- drivers/parport/probe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/parport/probe.c b/drivers/parport/probe.c index 5d1b9aacb130..bf9d81c0abaf 100644 --- a/drivers/parport/probe.c +++ b/drivers/parport/probe.c @@ -52,7 +52,7 @@ static void pretty_print(struct parport *port, int device) static void parse_data(struct parport *port, int device, char *str) { - char *txt = kmalloc(strlen(str)+1, GFP_KERNEL); + char *txt = kstrdup(str, GFP_KERNEL); char *p = txt, *q; int guessed_class = PARPORT_CLASS_UNSPEC; struct parport_device_info *info = &port->probe_info[device + 1]; @@ -61,7 +61,6 @@ static void parse_data(struct parport *port, int device, char *str) pr_warn("%s probe: memory squeeze\n", port->name); return; } - strcpy(txt, str); while (p) { char *sep; q = strchr(p, ';');