Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3354354pxf; Mon, 15 Mar 2021 07:50:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDNzfnCVuLy4TDtR8aM2t8ZaYfAeDYLkdizY1r+I9r8WYOFH9mqnKD9ah4G4k36Mfevk6B X-Received: by 2002:a17:906:684b:: with SMTP id a11mr23381895ejs.329.1615819816615; Mon, 15 Mar 2021 07:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615819816; cv=none; d=google.com; s=arc-20160816; b=rYKa/vApm0VmHYMXPazF54jYLo00x/V7XrLnPkBFE/NsvP0XUCEPtciQP7Nkv2adr+ PFroE8/EKSG7IceyU7O5PIp1Nc9L+uEraHThN3sOq4fCJXgAwuXlHu0AoaPNuPyxBAj0 I9yV8r6h6hLX4PH48sO6TV8/HsLOIk3XQ+yMsjjt/rzJF0jFREjKz5RgVyl+zC9yCf5e V35V4KTQjj8JE+x1+ukr5NOwgPgSWhN7Mbpegbj4dviCPVZ0LQRPq1VnfA+JE19kPp0g epZq6R3ZfJ1recjkSUuvuXWb3d+sNWEA1lWn0x5kMndgMxjEooyyqb9b08L/xSeY0MzI MeMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CsbJAJuv7nGlNEcIgMcob8gaBdvUCLEg9d9Fu+Hjets=; b=TZt3AgKhf47eP90MkDv/u0VckrdHVmD41bsCT8m3gAJiOZqCLn+ccX2ehAVj3AqxKz qPstg6iWzwxRCtrrZppwsekQyli9nhyYNqqJaf2BaosFS+Wb4n6Fz4rK99go0Hq9e6XM I0dWRrt3FmNZA2uUfIS80TaIAJhtiIvwtrhpjWhD0xnh/cfjdjKtMJGnCs9EKqz9TgHL egUBJ8l3LChUkD+lD872LPtU8RnZbdygwnwyqDCIG0EJhrxYh6Vv52RwLHG4iXWDuID1 8mAEnO5Vz5MtJGyosM6hUjtXgtVz02c8yJmj7fApv65g7WZ4ZJizXaGRhdP2asD/irXv BkXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Ch87m8l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si11028986eja.156.2021.03.15.07.49.53; Mon, 15 Mar 2021 07:50:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1Ch87m8l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240977AbhCOOsS (ORCPT + 99 others); Mon, 15 Mar 2021 10:48:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:49682 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234407AbhCOODU (ORCPT ); Mon, 15 Mar 2021 10:03:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E7BF64EEF; Mon, 15 Mar 2021 14:03:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817000; bh=Q7fOIOhYYEgWEapd03u/hAGSKrUrhyVrhseD34/Bq5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Ch87m8lX7oIqF5l1H0CljRDYCCV1lD+OLmUy89TBWhXaAmYpM4+00ZWfemtQqbMM qPQvFKK3/QpbRemxCdsMIJKEA2wvCUc7BWgoZB/wPQ05n+4SWyV4c1ibDw0aZxilqD QljPnHuWQ17jcVZ41bhwaW36CMksOduFOmXdDkj4= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Abbott Subject: [PATCH 5.10 240/290] staging: comedi: pcl818: Fix endian problem for AI command data Date: Mon, 15 Mar 2021 14:55:33 +0100 Message-Id: <20210315135550.107625889@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Ian Abbott commit 148e34fd33d53740642db523724226de14ee5281 upstream. The analog input subdevice supports Comedi asynchronous commands that use Comedi's 16-bit sample format. However, the call to `comedi_buf_write_samples()` is passing the address of a 32-bit integer parameter. On bigendian machines, this will copy 2 bytes from the wrong end of the 32-bit value. Fix it by changing the type of the parameter holding the sample value to `unsigned short`. [Note: the bug was introduced in commit edf4537bcbf5 ("staging: comedi: pcl818: use comedi_buf_write_samples()") but the patch applies better to commit d615416de615 ("staging: comedi: pcl818: introduce pcl818_ai_write_sample()").] Fixes: d615416de615 ("staging: comedi: pcl818: introduce pcl818_ai_write_sample()") Cc: # 4.0+ Signed-off-by: Ian Abbott Link: https://lore.kernel.org/r/20210223143055.257402-10-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/pcl818.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -423,7 +423,7 @@ static int pcl818_ai_eoc(struct comedi_d static bool pcl818_ai_write_sample(struct comedi_device *dev, struct comedi_subdevice *s, - unsigned int chan, unsigned int val) + unsigned int chan, unsigned short val) { struct pcl818_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd;