Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01ae0eea authored by Eric Lapuyade's avatar Eric Lapuyade Committed by John W. Linville
Browse files

NFC: Fix next target_idx type and rename for clarity

parent c4fbb651
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ struct nfc_genl_data {

struct nfc_dev {
	unsigned idx;
	unsigned target_idx;
	u32 target_next_idx;
	struct nfc_target *targets;
	int n_targets;
	int targets_generation;
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ int nfc_targets_found(struct nfc_dev *dev,
	dev->polling = false;

	for (i = 0; i < n_targets; i++)
		targets[i].idx = dev->target_idx++;
		targets[i].idx = dev->target_next_idx++;

	spin_lock_bh(&dev->targets_lock);

+2 −2
Original line number Diff line number Diff line
@@ -92,8 +92,8 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,
		goto error;
	}

	if (addr->target_idx > dev->target_idx - 1 ||
	    addr->target_idx < dev->target_idx - dev->n_targets) {
	if (addr->target_idx > dev->target_next_idx - 1 ||
	    addr->target_idx < dev->target_next_idx - dev->n_targets) {
		rc = -EINVAL;
		goto error;
	}