lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNrw4rxihFLuqLtY@ninjato>
Date:   Tue, 29 Jun 2021 12:07:30 +0200
From:   Wolfram Sang <wsa@...nel.org>
To:     Jie Deng <jie.deng@...el.com>
Cc:     linux-i2c@...r.kernel.org,
        virtualization@...ts.linux-foundation.org,
        linux-kernel@...r.kernel.org, mst@...hat.com, jasowang@...hat.com,
        andriy.shevchenko@...ux.intel.com, conghui.chen@...el.com,
        arnd@...db.de, kblaiech@...lanox.com,
        jarkko.nikula@...ux.intel.com, Sergey.Semin@...kalelectronics.ru,
        rppt@...nel.org, loic.poulain@...aro.org, tali.perry1@...il.com,
        u.kleine-koenig@...gutronix.de, bjorn.andersson@...aro.org,
        yu1.wang@...el.com, shuo.a.liu@...el.com, viresh.kumar@...aro.org,
        stefanha@...hat.com, pbonzini@...hat.com
Subject: Re: [PATCH v10] i2c: virtio: add a virtio i2c frontend driver

Hi,

so some minor comments left:

> +		if (!msgs[i].len)
> +			break;

I hope this can extended in the future to allow zero-length messages. If
this is impossible we need to set an adapter quirk instead.

> +		err = virtqueue_add_sgs(vq, sgs, outcnt, incnt, &reqs[i], GFP_KERNEL);
> +		if (err < 0) {
> +			pr_err("failed to add msg[%d] to virtqueue.\n", i);

Is it really helpful for the user to know that msg5 failed? We don't
even say which transfer.

> +static u32 virtio_i2c_func(struct i2c_adapter *adap)
> +{
> +	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;

You are not emulating I2C_FUNC_SMBUS_QUICK, so you need to mask it out.

> +	snprintf(vi->adap.name, sizeof(vi->adap.name), "Virtio I2C Adapter");

Is there something to add so you can distinguish multiple instances?
Most people want that.

> +	vi->adap.class = I2C_CLASS_DEPRECATED;
> +	vi->adap.algo = &virtio_algorithm;
> +	vi->adap.dev.parent = &vdev->dev;
> +	vi->adap.timeout = HZ / 10;

Why so short? HZ is the kinda default value.

> +	i2c_set_adapdata(&vi->adap, vi);
> +
> +	/* Setup ACPI node for controlled devices which will be probed through ACPI */
> +	ACPI_COMPANION_SET(&vi->adap.dev, ACPI_COMPANION(pdev));
> +
> +	ret = i2c_add_adapter(&vi->adap);
> +	if (ret) {
> +		virtio_i2c_del_vqs(vdev);
> +		dev_err(&vdev->dev, "failed to add virtio-i2c adapter.\n");

Won't the driver core print that for us?

> +	}
> +
> +	return ret;
> +}
> +

> +/* The bit 0 of the @virtio_i2c_out_hdr.@...gs, used to group the requests */
> +#define VIRTIO_I2C_FLAGS_FAIL_NEXT	0x00000001

BIT(0)?

Happy hacking,

   Wolfram


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ